-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9-3.html
112 lines (109 loc) · 3.34 KB
/
9-3.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>图片自动切换</title>
<link rel="stylesheet" type="text/css" href="reset.css">
<style>
.wrap{margin: 50px auto;border: 4px solid #c0c0c0;width: 500px;height: 300px;overflow: hidden;position: relative;}
#list{width: 2500px;height: 300px;background: #fff;position: absolute;top: 0;left: 0;}
#list li{width: 500px;height: 300px;float: left;position: relative;}
#list img{}
.desc{position: absolute;top: 300px;left: 0px;width: 500px;height: 80px;}
.shade{background: #000;opacity: 0.5;width: 500px;height: 80px;display: block;}
.word{position: absolute;top: 0;left: 0;color: #fff;}
</style>
<script src="9-1.js"></script>
<script>
window.onload = function(){
var oList = document.getElementById('list');
var aLi = oList.getElementsByTagName('li');
var aDiv = oList.getElementsByTagName('div');
var num = 0;
var speed = parseInt(getStyle(oList,'left'));
var step = parseInt(getStyle(aDiv[num],'top')); // 初始
var content = setInterval(function arr () {
oList.style.left = speed + 'px';
if (speed%500 == 0) {
clearInterval(content);
var t2 = setInterval(function() {
step-=10;
aDiv[num].style.top = step+'px';
if (step%220 == 0) {
clearInterval(t2);
setTimeout(function(){
var t3 = setInterval(function() {
step+=10;
aDiv[num].style.top = step+'px';
if (step%300 == 0) {
clearInterval(t3);
num++;
num<aDiv.length?content = setInterval(arr,20):clearInterval(content);
}
},100);
},1000);
}
},100);
}
speed-=10;
},20);
}
</script>
</head>
<body>
<div class="wrap">
<ul id="list">
<li>
<img src="imgs/i9/9-2-1.gif" alt="">
<div class="desc">
<span class="shade"></span>
<span class="word">
<h2>辣妈荧幕成绩单1</h2>
<p>辣妈荧幕成绩单《爸爸,去哪儿?》,今晚又要来了,你看过这些爸爸的电影了么?</p>
</span>
</div>
</li>
<li>
<img src="imgs/i9/9-2-2.gif" alt="">
<div class="desc">
<span class="shade"></span>
<span class="word">
<h2>辣妈荧幕成绩单2</h2>
<p>辣妈荧幕成绩单《爸爸,去哪儿?》,今晚又要来了,你看过这些爸爸的电影了么?</p>
</span>
</div>
</li>
<li>
<img src="imgs/i9/9-2-3.gif" alt="">
<div class="desc">
<span class="shade"></span>
<span class="word">
<h2>辣妈荧幕成绩单3</h2>
<p>辣妈荧幕成绩单《爸爸,去哪儿?》,今晚又要来了,你看过这些爸爸的电影了么?</p>
</span>
</div>
</li>
<li>
<img src="imgs/i9/9-2-4.gif" alt="">
<div class="desc">
<span class="shade"></span>
<span class="word">
<h2>辣妈荧幕成绩单4</h2>
<p>辣妈荧幕成绩单《爸爸,去哪儿?》,今晚又要来了,你看过这些爸爸的电影了么?</p>
</span>
</div>
</li>
<li>
<img src="imgs/i9/9-2-5.gif" alt="">
<div class="desc">
<span class="shade"></span>
<span class="word">
<h2>辣妈荧幕成绩单5</h2>
<p>辣妈荧幕成绩单《爸爸,去哪儿?》,今晚又要来了,你看过这些爸爸的电影了么?</p>
</span>
</div>
</li>
</ul>
</div>
</body>
</html>