最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - CSS trigger javascript after transitionanimation - Stack Overflow

programmeradmin1浏览0评论

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 pleted.

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 pleted.

Share Improve this question edited Dec 4, 2012 at 6:31 Mayur Birari 5,8358 gold badges36 silver badges61 bronze badges asked Dec 4, 2012 at 6:13 AlbertoAlberto 1361 silver badge5 bronze badges 3
  • 2 Similiar stackoverflow./questions/2087510/callback-on-css-transition – Musa Commented Dec 4, 2012 at 6:31
  • Awesome I didn't find that before posting. I need to fully test it but it seems to fit my needs. – Alberto Commented Dec 4, 2012 at 7:17
  • Does this answer your question? Callback on CSS transition – djvg Commented Mar 30, 2023 at 13:40
Add a ment  | 

1 Answer 1

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

See: Callback on CSS transition

发布评论

评论列表(0)

  1. 暂无评论