If the setTimeout feels hacky (a view I tend to agree with), you could use the transitionend event instead.

The transitionend event is fired when a CSS transition has completed. In the case where a transition is removed before completion, such as if the transition-property is removed or display is set to "none", then the event will not be generated.