您好,登錄后才能下訂單哦!
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>隨機圖片滾動</title>
<!--可成功執行,布局有點混亂...懶得改了。需要一個js文件,在上一文章中有-->
<style type="text/css">
*{
padding:0;
margin: 0;
}
li,ul{
list-style: none;
}
#parent{
margin: 0 auto;
width: 830px;
height: 900px;
border:3px solid #C1C1C1;
margin-top: 50px;
}
#parent>ul>li{
float: left;
width: 400px;
height: 225px;
}
#parent>ul>li ul{
width: 380px;
height: 200px;
position: relative;
}
#parent>ul>li li{
width: 380px;
height: 200px;
position: relative;
}
img{
}
</style>
<script src="miaov.js"></script>
<script type="text/javascript">
window.onload=function(){
var setTime=null;
setTime=setInterval(function(){
//bianhuan(7);
//返回一個X-Y之間的隨機數
var num =stochastic(0,7);
bianhuan(num);
},500);
}
function bianhuan(a){
//var obj=getID('son');
//讓層上下左右移動 ,參數 標簽對象,上/下/左/右,終點距離,回調函數
var Oli=document.getElementsByName("fail");
var Oul=Oli[a].getElementsByTagName("ul")[0];
var Tli=Oul.getElementsByTagName("li");
doMove ( Oul, 'top', 15, -200,function(){
Oul.style.top='0px';
Oul.insertBefore(Tli[0],Tli[Tli.length]);
});
}
function getID(obj){
return document.getElementById(obj);
}
</script>
</head>
<body>
<div id="parent">
<!--圖片途徑改-->
<ul id="son">
<li name="fail">
<div Apple-tab-span" >width: 380px;
height: 200px;
overflow: hidden;">
<ul>
<li><img src="p_w_picpaths/scenery_1.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_2.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_3.jpg" width=380 height=200/></li>
</ul>
</div>
</li>
<li name="fail" ><div Apple-tab-span" >width: 380px;
height: 200px;
overflow: hidden;">
<ul>
<li><img src="p_w_picpaths/scenery_4.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_5.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_6.jpg" width=380 height=200/></li>
</ul>
</div>
</li>
<li name="fail"><div Apple-tab-span" >width: 380px;
height: 200px;
overflow: hidden;">
<ul>
<li><img src="p_w_picpaths/scenery_7.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_8.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_9.jpg" width=380 height=200/></li>
</ul>
</div>
</li>
<li name="fail"><div Apple-tab-span" >width: 380px;
height: 200px;
overflow: hidden;">
<ul>
<li><img src="p_w_picpaths/scenery_10.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_11.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_12.jpg" width=380 height=200/></li>
</ul>
</div>
</li>
<li name="fail"><div Apple-tab-span" >width: 380px;
height: 200px;
overflow: hidden;">
<ul>
<li><img src="p_w_picpaths/scenery_13.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_14.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_15.jpg" width=380 height=200/></li>
</ul>
</div>
</li>
<li name="fail"><div Apple-tab-span" >width: 380px;
height: 200px;
overflow: hidden;">
<ul>
<li><img src="p_w_picpaths/scenery_16.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_17.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_18.jpg" width=380 height=200/></li>
</ul>
</div>
</li>
<li name="fail"><div Apple-tab-span" >width: 380px;
height: 200px;
overflow: hidden;">
<ul>
<li><img src="p_w_picpaths/scenery_19.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_20.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_21.jpg" width=380 height=200/></li>
</ul>
</div>
</li>
<li name="fail"><div Apple-tab-span" >width: 380px;
height: 200px;
overflow: hidden;">
<ul>
<li><img src="p_w_picpaths/scenery_22.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_23.jpg" width=380 height=200/></li>
<li><img src="p_w_picpaths/scenery_24.jpg" width=380 height=200/></li>
</ul>
</div>
</li>
</ul>
</div>
</body>
</html>
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。