如何使自适应背景图像不断增加并恢复原始尺寸?

时间:2015-01-29 13:02:49

标签: jquery css html5 css3

我需要在jpg中制作页面背景图像以进行动画制作 - 我找到了一个恒定平滑增加图像的解决方案,然后返回到它的实际尺寸而不会变小。没有悬停 - 自动没有用户的任何活动。

请帮助:)

1 个答案:

答案 0 :(得分:2)

试试这个你可以用css Fiddle

来做



.bg {
    width:200px;
    background:url('http://placekitten.com/300/301');
    height:200px;
    background-size:100%;
    -webkit-animation:lar 5s infinite;
}
@-webkit-keyframes lar {
    0% {
        background-size:100%;
    }
    50% {
        background-size:200%;
    }
    100% {
        background-size:100%;
    }
}
}

<div class="bg"></div>
&#13;
&#13;
&#13;