1

I'm not looking to trigger a CSS animation from JS, but rather the opposite.

If I do a CSS animation via the -webkit-transition or transition: all 1000ms type style sheet, is there a way to trigger a JS function after the transition is done?

Basically I've been doing animations via javascript and I want to convert some of them to CSS animations, but I need to trigger javascript events after the animations have completed.

Mayur Birari
  • 5,850
  • 8
  • 33
  • 61
Alberto
  • 136
  • 1
  • 5

2 Answers2

5
box.addEventListener('webkitTransitionEnd', function( event ) { 
     alert( "Finished transition!" ); 
}, false );

See: Callback on CSS transition

Community
  • 1
  • 1
Jack eten
  • 66
  • 1
1

I think you would need javascript before the transition, to trigger it, and after it. to make some sort of callback... but my knowledge is very poor

invicente
  • 152
  • 7