const myElement = document.getElementById('myElement');
myElement.addEventListener('animationend', () => {
// Do something when the animation ends
});```
```bash
// 例子
door.addEventListener('animationend',(e)=>{
// 可根据动画的名称来决定做什么事情 有的div可能有两个动画效果
if( e.animationName == 'closeDoorTop'){
setTimeout(()=>{
this.audioAll.audio5_1.play()
this.closeDoor = false
this.openDoor = true
this.page2 = false
this.page3 = true
this.isdelay = true
},1000)
}
if(e.animationName == 'openDoorTop'){
this.isShowDoor = false
}
})
js监听 css动画animate 结束
于 2023-04-20 09:03:20 首次发布