Firefox 中的 CSS3 动画和背景图像

标签 css firefox animation

我的网站中有一些 CSS3 动画,它在 Safari 上运行良好,但当我在 Firefox 中运行该网站时,它没有动画。这是代码:

.ad{
position:relative;
left:740px;
top:240px;
width:260px;
height:195px;
background-image:url('ad1.png');

animation:myfirst 4s; 

-webkit-animation:myfirst 4s; /* Safari and Chrome */
-webkit-animation-delay:2s;
-webkit-animation-duration:0s;
-webkit-animation-fill-mode: forwards;
}

@keyframes myfirst 

 {
  from {background-image:url('ad1.png')}
  to {background-image:url('ad2.png')}

 }


@-webkit-keyframes myfirst /* Safari and Chrome */
 {
  from {background-image:url('ad1.png');}
  to {background-image:url('ad2.png');}
 }
}

现在我注意到当网站点击

 background-image:url('');

如果我要将这些更改为

 background:color;  

然后就可以了,但显然我想使用图像。我试过添加 -moz- 前缀,但它不起作用。我错过了什么?有没有办法让 firefox 承认

Background-image:url('')

最佳答案

根据latest working draft of the spec (2015 年 8 月 14 日),background-image 被定义为不可设置动画。

然后,Firefox 只是遵循规范,动画 background-image 的浏览器的行为是非标准的,不应依赖。

关于Firefox 中的 CSS3 动画和背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40368589/

相关文章:

ios - 带有重复和自动反转的快速 UIView animateWithDuration

JavaScript 如果 CSS 动画结束

PHP CSS - 加载外部文件或回显到头部的更快/良好实践?

javascript - 单击添加元素并单击删除相同的元素

java - session 未创建异常 : Unable to create new service: GeckoDriverService with Selenium Grid on Ubuntu failing to drive Firefox

forms - -moz-box-sizing 规则阻止用户在 firefox 中看到表单字段输入

css - 在 WordPress 中将背景位置设置为顶部

javascript - Firefox 边栏获取选项卡 URL

ios - 在 Swift 中使用 animateWithDuration 自定义 UIViewController 转换

html - 使用 Animate.css 动画化 anchor 标签