css animation & animationend event & onanimationend
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/animationend_event
https://developer.mozilla.org/en-US/docs/Web/API/Document/animationend_event
const animated = document.querySelector('.animated');
animated.addEventListener('animationend', () => {
console.log('Animation ended');
});
const animated = document.querySelector('.animated');
animated.onanimationend = () => {
console.log('Animation ended');
};
animationstart event & onanimationstart
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/animationstart_event
const animated = document.querySelector('.animated');
animated.addEventListener('animationstart', () => {
console.log('Animation started');
});
const animated = document.querySelector('.animated');
animated.onanimationstart = () => {
console.log('Animation started');
};
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!