Thr trouble is that the transitionEnd event doesn't fire under some circumstances (eg if the animated element is hidden). So, it's more reliable to use a timer instead