CSS 反弹动画在 FF 中不起作用

标签 css animation

我有一个通过 webkit 工作的简单弹跳动画,知道为什么这个动画在 FF 中不工作吗?

@-webkit-keyframes bounce { 
    0%, 20%, 50%, 80%, 100% {-webkit-transform: translateY(0);} 
    40% {-webkit-transform: translateY(-6px);}
    60% {-webkit-transform: translateY(-3px);}
} 

@keyframes bounce { 
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 
    40% {transform: translateY(-6px);}
    60% {transform: translateY(-3px);}
}

@-moz-keyframes bounce { 
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 
    40% {transform: translateY(-6px);}
    60% {transform: translateY(-3px);}
}

element {
    -webkit-animation: bounce 1.7s ease-in-out infinite;
    -moz-animation-name: bounce 1.7s ease-in-out;
    -ms-animation-name: bounce 1.7s ease-in-out;
    -o-animation-name: bounce 1.7s ease-in-out;
    animation-name: bounce 1.7s ease-in-out;
}

谢谢!

最佳答案

这是因为你为其他浏览器设置了animation-name而不是animation:

div {
  -webkit-animation: bounce 1.7s ease-in-out infinite;
  -moz-animation: bounce 1.7s ease-in-out infinite;
  -ms-animation: bounce 1.7s ease-in-out infinite;
  -o-animation: bounce 1.7s ease-in-out infinite;
  animation: bounce 1.7s ease-in-out infinite;
}

Demo .

请注意,如果您使用animation-name,您必须单独设置其他与动画相关的属性,如下所示:

-moz-animation-name: bounce;
-moz-animation-duration:1.7s;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;

关于CSS 反弹动画在 FF 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24592892/

相关文章:

html - 在以下情况下如何使用 CSS 在悬停时更改元素属性

css - R Shiny : Interactively modify application theme

c# - 141 是可以同时设置动画的 WPF 面板项的最大数量吗?

ios - swift 如何让动画在两个 UIView 之间翻转

html - 禁用移动设备的内容

css - Bootstrap 在具有多个元素的行中垂直对齐(到所有列)

html - CSS使文字显示在图片下方

Android:在 FrameLayout 中翻译动画后无法单击底部的 TextView

reactjs - 使用 Velocity.js 从 URL 渲染 SVG 进行动画

animation - jpg图像可以支持动画吗?