






















.shakeAnimate { animation: shakeAnimation 2s ease-in-out forwards; }
const showAnimation = () => { const box = document.querySelector('.box') if (box) { if (box.classList.contains('shakeAnimate')) { box.classList.remove('shakeAnimate') // 强制重绘 box.offsetWidth // eslint-disable-line no-unused-expressions } box.classList.add('shakeAnimate') } }
在需要展示动画的地方调用此方法即可。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。