-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.php
More file actions
99 lines (94 loc) · 2.49 KB
/
text.php
File metadata and controls
99 lines (94 loc) · 2.49 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>text</title>
<style>
*{
padding: 0;
margin: 0;
}
#div1{
width: 1140px;
height: 290px;
overflow: hidden;
background:red;
position: relative;
}
#div1 ul{
position: absolute;
left: 0;
top: 0;
transition:left 1s;
-moz-transition:left 1s; /* Firefox 4 */
-webkit-transition:left 1s; /* Safari and Chrome */
-o-transition:left 1s; /* Opera */
}
#div1 ul li{
float: left;
width: 1140px;
height: 290px;
list-style: none;
}
.arrow { cursor: pointer; display: none; line-height: 39px; text-align: center; font-size: 36px; font-weight: bold; width: 40px; height: 40px; position: absolute; z-index: 2; top: 125px; background-color: RGBA(0,0,0,.3); color: #fff; text-decoration: none;}
.arrow:hover { background-color: RGBA(0,0,0,.7);}
#div1:hover .arrow { display: block;}
#prev { left: 20px;}
#next { right: 20px;}
</style>
<script>
window.onload=function(){
var div=document.getElementById('div1');
var ul=document.getElementsByTagName('ul')[0];
var li=document.getElementsByTagName('li');
var prev=document.getElementById('prev');
var next=document.getElementById('next');
ul.style.width=li[0].offsetWidth*li.length+'px';
var timer;
// 开始运动
function startmove(offset){
ul.style.left=ul.offsetLeft+offset+'px';
if(ul.offsetLeft<-6840){
ul.style.left=0+'px';
}
if(ul.offsetLeft>0){
ul.style.left=-6840+'px';
}
}
next.onclick=function(){
startmove(-1140);
}
prev.onclick=function(){
startmove(1140);
}
function play() {
timer = setInterval(function () {
next.onclick();
}, 5000);
}
function stop() {
clearTimeout(timer);
}
div.onmouseover=stop();
div.onmouseout=play();
play();
}
</script>
</head>
<body>
<div id="div1">
<ul >
<li><a href=""><img src="img/11.jpg" alt=""></a></li>
<li><a href=""><img src="img/22.jpg" alt=""></a></li>
<li><a href=""><img src="img/33.jpg" alt=""></a></li>
<li><a href=""><img src="img/44.jpg" alt=""></a></li>
<li><a href=""><img src="img/55.jpg" alt=""></a></li>
<li><a href=""><img src="img/66.jpg" alt=""></a></li>
<li><a href=""><img src="img/77.jpg" alt=""></a></li>
<li><a href=""><img src="img/88.jpg" alt=""></a></li>
</ul>
<a href="javascript:;" id="prev" class="arrow"><</a>
<a href="javascript:;" id="next" class="arrow">></a>
</div>
</body>
</html>