2

Is there a way to tell when a animation hits 100% of its animation with jQuery?

{0%{-xxx-transform:translate(0,0);}
100%{-xxx-transform:translate(-500px, 300px); opacity: 0.1;}
Rich Bradshaw
  • 71,795
  • 44
  • 182
  • 241
Philip
  • 6,827
  • 13
  • 75
  • 104

3 Answers3

1

This is the right answer.

$(elem).bind('webkitAnimationEnd', function (event) { //function });

How do I re-trigger a WebKit CSS animation via JavaScript?

Community
  • 1
  • 1
Philip
  • 6,827
  • 13
  • 75
  • 104
0

Just for clarity's sake, here's a list of all the browser-specific 'animationEnd' properties:

$('#foo').bind('animationEnd oAnimationEnd msAnimationEnd mozAnimationEnd webkitAnimationEnd', function(event){
    // Do stuff once the CSS animation has finished.
});
Labu
  • 2,572
  • 30
  • 34
0

You could use the transitionend event.

$('#elem').bind('transitionend', function()
{
    alert('finished animating');
});
MacMac
  • 34,294
  • 55
  • 151
  • 222
  • Thanks for your answer but actually transitionend wasn't the right way to go. But 'webkitAnimationEnd' or 'animationEnd'. – Philip Mar 05 '12 at 08:50