css - 重启多个 CSS3 动画

标签 css

如果您使用逗号分隔值来声明多个 CSS3 动画,您如何重新启动整个动画本身?首先运行 slideUp,然后运行 ​​fadeOut(通过 animation-delay 属性实现),然后重新启动。

.mySelector {
   myAnimation: 
     -webkit-animation:  slideUp 0.5s ease-in-out 0 1 normal forwards running, 
                         fadeOut 1s ease-in-out 2s 1 normal forwards running;
}

最佳答案

您可以通过删除并再次添加该元素来完成此操作:

var elm = document.querySelector(".mySelector");
var newone = elm.cloneNode(true);
elm.parentNode.replaceChild(newone, elm);

https://css-tricks.com/restart-css-animation/

关于css - 重启多个 CSS3 动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28798688/

相关文章:

css - 是位置 : fixed z-index relative to its parent's z-index?

html - 跨屏幕尺寸对齐图像和 div

html - 强调 html 提交按钮的正确方法?

html - 我的文字位于页脚下方的原因是什么?

css - 同一 css 属性的多个值

html - 在 IE8 和 IE 10 中的不同位置

css - 自定义扩展面板__header高度

css - 如何使用 Nokogiri 获取列表中的第二张图片?

css - 包含三个单元格的表 : auto-resize left and right in pure CSS

html - css 列表错位