Reputation: 47933
I looked around and couldn't find any. In my app in order to trigger an animation on an element, I add a class with that desired animation to the element. Then I want to listen to the animation end event and run some code when it is fired.
As far as I can tell jQuery does not have this feature implemented already in a cross-browser way already (e.g. $(document).on('animationEnd', 'selector', callback)
).
While it is easy to implement this manually, I was wondering if there's a third-party library available that does this already?
Upvotes: 1
Views: 83
Reputation: 1742
Try:
transitionend
webkitTransitionEnd
oTransitionEnd
MSTransitionEnd
You can use something like:
$('#yourelement').addClass('animatedClass').on('transitionend', function(e) {
// ... do stuff.
);
There is also
:animated
which you can test against,
if ( $('#yourelement:not(:animated)') ) { ...
if ( $('#yourelement').is(':animated') ) { ...
Hope that sets you on the right path =)
Upvotes: 2