我最近才开始自学如何使用 jquery 函数,通常我可以自己解决问题(当然还有谷歌)。今天我只是没有想法,我发现自己基本上是在兜圈子,所以我希望有人能帮助我。
好的,这是我正在使用的页面:https ://dl.dropboxusercontent.com/u/60521097/ServZoo/HTML/index.html
基本上,我想做的就是让云 div 从屏幕左侧进入,浮动到右侧(在中心元素后面),退出屏幕,然后重复。我整天都在摆弄这个,已经到了我不知道哪条路向上的地步:-/好吧,就是这样……
#bg-wrapper {
max-width:2920px;
overflow: hidden;
margin: 0 auto;
background: url(images/Untitled-3.jpg) left top;
background-size: 100% 924px;
background-repeat:no-repeat;
background-attachment: fixed;
}
#bg-inner {
width:2305px;
height: 1080px;
position: absolute;
overflow: hidden;
margin:0px;
}
#cloudone {
position:absolute;
margin-top:5px;
margin-left:-200px;
z-index: 1;
filter:alpha(opacity=80);
/* CSS3 standard */
opacity:0.8;
}
#cloudtwo {
position:absolute;
margin-top:85px;
margin-left:-300px;
z-index: 2;
filter:alpha(opacity=60);
/* CSS3 standard */
opacity:0.6;
}
#cloudthree {
position:absolute;
margin-top:65px;
margin-left:-600px;
z-index: 4;
filter:alpha(opacity=70);
/* CSS3 standard */
opacity:0.7;
}
#boat {
margin-top:620px;
position:absolute;
margin-right:-2105px;
z-index: 6;
}
还有剧本...
$(document).ready(function() {
setTimeout("cloudone()",10);
setTimeout("cloudtwo()",13);
setTimeout("cloudthree()",18);
setTimeout("boat()",40);
});
function cloudone(){
$("#cloudone").animate({left:"600px"},5000).animate({right:"600px"}, 5000)
setTimeout("cloudone()",10000);
}
function cloudtwo(){
$("#cloudtwo").animate({left:"700px"},7000).animate({right:"700px"}, 6000)
setTimeout("cloudtwo()",13000);
}
function cloudthree(){
$("#cloudthree").animate({left:"1000px"},10000).animate({right:"1000px"}, 8000)
setTimeout("cloudthree()",18000);
}
function boat(){
$("#boat").animate({right:"2105px"},20000).animate({left:"2105px"}, 20000)
setTimeout("boat()",40000);
}