forked from Fzw-com/animate_demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sort-roll.html
80 lines (79 loc) · 2.59 KB
/
sort-roll.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
div,ul,li,img{margin:0;padding:0;}
li{list-style:none;}
#box{width:450px;height:400px;border:2px #666 solid;margin:50px auto 0;}
#box ul{width:450px;height:200px;position:relative;overflow:hidden;}
#box li{width:150px;height:200px;float:left;position:absolute;left:0;top:0;}
#box img{width:150px;height:200px;}
</style>
<script src="js/doMove.js"></script>
<script>
window.onload=function(){
var oDiv=document.getElementById('box');
var aLi=oDiv.getElementsByTagName('li');
var oUl=document.getElementsByTagName('ul');
var aLiTop=oUl[0].getElementsByTagName('li');
var aLiBottom=oUl[1].getElementsByTagName('li');
var Img=oDiv.getElementsByTagName('img');
var ranLi=null;
var ranImg=null;
for(var i=1;i<aLiTop.length;i++){
aLiTop[i].style.left = aLi[0].offsetWidth*i+'px';
}
for(var i=1;i<aLiBottom.length;i++){
aLiBottom[i].style.left = aLi[0].offsetWidth*i+'px';
}
setInterval(fnTab,1000);
function fnTab(){
ranLi=Math.round(Math.random()*6);
ranImg=Math.round(Math.random()*2);
console.log( ranLi,ranImg );
doMove(aLi[ranLi],'top',12,ranImg*-200);
}
}
</script>
</head>
<body>
<div id="box">
<ul>
<li>
<img src="img/sort-roll-img/1.jpg" />
<img src="img/sort-roll-img/2.jpg" />
<img src="img/sort-roll-img/3.jpg" />
</li>
<li>
<img src="img/sort-roll-img/5.jpg" />
<img src="img/sort-roll-img/4.jpg" />
<img src="img/sort-roll-img/7.jpg" />
</li>
<li>
<img src="img/sort-roll-img/8.jpg" />
<img src="img/sort-roll-img/6.jpg" />
<img src="img/sort-roll-img/10.jpg" />
</li>
</ul>
<ul>
<li>
<img src="img/sort-roll-img/3.jpg" />
<img src="img/sort-roll-img/12.jpg" />
<img src="img/sort-roll-img/2.jpg" />
</li>
<li>
<img src="img/sort-roll-img/6.jpg" />
<img src="img/sort-roll-img/9.jpg" />
<img src="img/sort-roll-img/7.jpg" />
</li>
<li>
<img src="img/sort-roll-img/10.jpg" />
<img src="img/sort-roll-img/11.jpg" />
<img src="img/sort-roll-img/4.jpg" />
</li>
</ul>
</div>
</body>
</html>