且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检测时,CSS动画,并开始使用JavaScript结束?

更新时间:2022-01-26 09:00:11

绑定相应的事件的元素,例如

Bind the appropriate events to the element, e.g.

el.addEventListener("animationstart", function() {}, false);
el.addEventListener("animationend", function() {}, false);
el.addEventListener("animationiteration", function() {}, false);

https://developer.mozilla.org/en-US/docs/CSS/Tutorials/Using_CSS_animations#Using_animation_events

请注意:您可能需要添加相应的prefixed事件为好,例如 webkitAnimationEnd

Note: You may need to add the appropriate prefixed-events as well, e.g. webkitAnimationEnd