首先我们在页面上放置两种背景飘动的云.cloud,和浮在太阳上的云朵#weather。
<div id="mainBody">
<div id="cloud1" class="cloud"></div>
<div id="cloud2" class="cloud"></div>
</div>
<div id="weather">
<img src="images/cloud.png" width="300"/>
</div> 接着我们对背景云朵定时动画。
setInterval(function flutter() {
if (offset1 >= mainwidth) {
offset1 = -580;
}
if (offset2 >= mainwidth) {
offset2 = -580;
}
offset1 += 1.1;
offset2 += 1;
$cloud1.css("background-position", offset1 + "px 30px")
$cloud2.css("background-position", offset2 + "px 340px")
}, 70);
*
回帖描述:*
链接类型:*
下载链接:*
描述:*
回帖描述:*
链接类型:*
阅读权限:*
下载链接:



聚优部落技术论坛 © 版权所有 鲁ICP备15007479号-6
Copyright(C)web.com, All Rights Reserved.
