CSS动画背景不起作用

标签 css animation

我的动画背景没有动...我不明白为什么...

图像正常显示,但没有任何移动....

我的 HTML:

<div class="section1">
</div>

我的 CSS:

@keyframes animatedBackground {    
    0% { background-position: 0 0; }    
    100% { background-position: 100% 0; }    
}    
@-moz-keyframes animatedBackground {    
    0% { background-position: 0 0; }    
    100% { background-position: 100% 0; }    
}    
@-webkit-keyframes animatedBackground {    
    0% { background-position: 0 0; }    
    100% { background-position: 100% 0; }    
}    
@-ms-keyframes animatedBackground {    
    0% { background-position: 0 0; }    
    100% { background-position: 100% 0; }    
}    
@-o-keyframes animatedBackground {    
    0% { background-position: 0 0; }    
    100% { background-position: 100% 0; }    
}    


.section1       {     
    background-image: url(mosaic.jpg);    
    background-position: 0px 0px;    
    background-repeat: repeat-x;    
    animation: animatedBackground 40s linear infinite;    
}

任何帮助将不胜感激......谢谢

最佳答案

尝试为 Safari、Chrome 和 Opera 添加 -webkit 前缀(仍然是 require 它):

.section1    {     
    background-image: url(mosaic.jpg);    
    background-position: 0px 0px;    
    background-repeat: repeat-x;    
   -webkit-animation: animatedBackground 40s linear infinite;  
    animation: animatedBackground 40s linear infinite;    
}

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

相关文章:

Javascript链接具有不同参数的相同动画功能

ios - duration 和 UISpringTimingParameters 在 UIViewPropertyAnimator 中如何交互?

iphone - 使用动画删除 UITableView Cell

javascript - 同时运行分组动画 jQuery

javascript - 交换 <div> 位置导致 CSS3 过渡效果丢失

javascript - Bootstrap 缩略图通过 Angular-Vertilize 保持高度

javascript - 绘制点标签的显示未正确显示在每月第一天的 X 范围图表上 - Highcharts

jquery - JQuery中鼠标悬停和鼠标悬停时停止和继续动画的方法

css - 悬停时的背景

javascript - 我无法使用 jQuery CSS 选择器正确选择标题文本