Alberto
Alberto

Reputation: 136

CSS trigger javascript after transition/animation

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.

Upvotes: 1

Views: 5815

Answers (1)

Jack eten
Jack eten

Reputation: 66

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

See: Callback on CSS transition

Upvotes: 5

Related Questions