html - 图像重叠和动画

标签 html css

我正在尝试为图像制作动画(使用 class="under")并与静止图像(使用 class="over")重叠。动画效果在 Firefox 和 IE-9 浏览器下的下图效果很好,而 Chrome 不显示动画。 Chrome 显示两个静止图像。 请任何解决方案。


.under
{
border-style: solid;
border-color: #0000ff;
border-radius:15px;
position: absolute;
left:173px;
top:0px;
z-index: 1;
}
.over
{
position:relative;
left:100px;
top:20px;
z-index: 2;
border-radius: 15px;
}


@keyframes animatedBackground {
    from { background-position: 0 0; }
    to { background-position: 100% 0; }

#animate-area   { 

        width: 1000px; 
        height: 160px; 

        background-image: url(images/img7.jpg);
        background-position: 0px 0px;
        background-repeat: repeat-x;
        opacity: 0.4;
        filter: alpha(opacity=40); /* For IE8 and earlier */

    animation: animatedBackground 40s linear infinite;
    -webkit-animation: animatedBackground 40s linear infinite;
    -moz-animation: animatedBackground 40s linear infinite;

}


谢谢 阿南德

最佳答案

试试@-webkit-keyframes animatedBackground

@-webkit-keyframes animatedBackground {
from { background-position: 0 0; }
to { background-position: 100% 0; }

@keyframes animatedBackground {
from { background-position: 0 0; }
to { background-position: 100% 0; }

关于html - 图像重叠和动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27087046/

相关文章:

JavaScript 作为行内 block 去间距的强大 hack

html - CSS 负边距重叠不适用于子元素

屏幕中间的 HTML 和 CSS div

javascript - 用于验证空输入字段不起作用的 JS 函数

jquery - 将鼠标悬停在图像上时更改 div 标签内的文本?

javascript - 表单重置后调用函数

css - 如何使用 "width auto"和 "float"对齐div?

jquery - 当用户滚动鼠标时,如何使 Div 内的文字消失?

javascript - 单击控件的大小更改

javascript - 此时元素按钮上不允许属性 href