forked from yangxi0126/javaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo8.html
58 lines (52 loc) · 1.58 KB
/
demo8.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
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>妙味课堂-www.miaov.com</title>
<style>
body,ul,ol{margin:0;padding:0;}
li{ list-style:none;}
img{ border:none; vertical-align:top; }
#box{width:470px;height:150px; position:relative; margin:30px auto; overflow:hidden;}
ul{ width:470px; position:absolute;left:0; top:0; z-index:1;}
ul li{width:470px; position:absolute; top:0;}
ol{z-index:2; width:120px; position:absolute;right:10px; bottom:10px;}
ol li{ width:20px;height:20px; float:left;margin:0 2px; display:inline; background:#fff; color:#f60; line-height:20px; text-align:center;}
ol .active{ background:#f60; color:#fff;}
</style>
<script type="text/javascript" src="move.js"></script>
<script>
window.onload = function(){
var oUl = document.getElementsByTagName('ul')[0];
var aLiUl = oUl.getElementsByTagName('li');
for(var i=1;i<aLiUl.length;i++){
aLiUl[i].style.left = (470 - 120) + (i-1)*30 + 'px';
}
for(var i=0;i<aLiUl.length;i++){
aLiUl[i].index = i;
aLiUl[i].onmouseover = function(){
for(var i=0;i<aLiUl.length;i++){
if( i <= this.index ){
startMove( aLiUl[i],{left : i*30} );
}
else{
startMove( aLiUl[i],{left : (470 - 120) + (i-1)*30} );
}
}
};
}
};
</script>
</head>
<body>
<div id="box">
<ul>
<li><img src="images/1.jpg" alt=""/></li>
<li><img src="images/2.jpg" alt=""/></li>
<li><img src="images/3.jpg" alt=""/></li>
<li><img src="images/4.jpg" alt=""/></li>
<li><img src="images/5.jpg" alt=""/></li>
</ul>
</div>
</body>
</html>