当 CSS 动画开始时执行一些操作:
const div1 = document.getElementById("myDIV");
div1.addEventListener("animationstart", myStartFunction);
亲自试一试 »
这个animationstart
事件发生时CSS 动画开始。
Event | Occurs When |
---|---|
animationstart | A CSS animation has started |
animationend | A CSS animation has completed |
animationiteration | A CSS animation is repeated |
Property | Description |
---|---|
animationName | The name of the animation |
elapsedTime | The number of seconds an animation has been running |
pseudoElement | The name of the pseudo-element of the animation |
气泡: | 是的 |
---|---|
可取消: | 不 |
事件类型: | 动画事件 |
DOM 版本: | 3 级活动 |
onanimationstart
是 DOM Level 3 (2004) 功能。
所有现代浏览器都完全支持它:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!