-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path作业7.js
93 lines (89 loc) · 1.89 KB
/
作业7.js
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
/*
* @Author: 16284
* @Date: 2019-12-10 15:23:13
* @Last Modified by: 16284
* @Last Modified time: 2019-12-10 15:56:57
*/
var bo = document.getElementById("bo");
var ull = document.getElementById("ull").children;
var pans = document.getElementById("pans");
var left = document.getElementById("left");
var right = document.getElementById("right");
var ge = 1;
var time = setInterval(next,3000);
var tag = false;
function next(){
if(tag){
return;
}
tag = true;
ge++;
ullmove();
animate(pans,{left:-1200*ge}, function(){
if(ge == 6){
pans.style.left = '-1200px';
ge = 1;
}
tag = false;
});
}
function prev(){
if(tag){
return;
}
tag = true;
ge--;
ullmove();
animate(pans,{left:-1200*ge},function(){
if(ge == 0){
pans.style.left = '-6000px';
ge = 5;
}
tag = false;
});
}
bo.onmouseover = function(){
animate(left,{opacity:50});
animate(right,{opacity:50});
clearInterval(time);
}
bo.onmouseout = function(){
animate(left,{opacity:0});
animate(right,{opacity:0});
time = setInterval(next,3000);
}
right.onclick = next;
left.onclick = prev;
for(var i=0;i<ull.length;i++){
ull[i].ge = i;
ull[i].onclick = function(){
ge = this.ge +1;
ullmove();
animate(pans,{left:-1200*ge});
}
}
function ullmove(){
for(var i = 0;i < ull.length;i++){
ull[i].className = "";
}
if(ge > 5){
ull[0].className = "action";
}
else if(ge <= 0){
ull[4].className = "action";
}
else{
ull[ge-1].className = "action";
}
}
var labaaa = document.getElementById("labaaa");
document.body.onload = function(){
var time1 = setInterval(function(){
var now = parseInt(getStyle(labaaa,"right"));
labaaa.style.right = now + 1 + "px";
if(now == 1020){
labaaa.style.right = -150 + "px";
now = 0;
}
},20);
}