-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtab.js
More file actions
143 lines (136 loc) · 4.03 KB
/
Copy pathtab.js
File metadata and controls
143 lines (136 loc) · 4.03 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
$(function(){
(function(){
var oBox1 = getByClass(document,"box1")[0];
var oUl = oBox1.children[0];
var aBtn = oBox1.children[1].children;
var iNow = 0;
var fx = Tween.Linear
for (var i = 0; i < aBtn.length; i++) {
(function(index){
aBtn[i].onclick=function(){
iNow = index;
tab();
};
})(i);
};
function tab(){
for (var i = 0; i < aBtn.length; i++) {
aBtn[i].className="";
};
aBtn[iNow].className="active";
move(oUl,{left:-iNow*oUl.children[0].offsetWidth},{easing:fx});
};
function next(){
iNow++;
iNow==aBtn.length && (iNow=0);
tab();
};
var timer = setInterval(next, 1500);
oBox1.onmouseover=function(){
clearInterval(timer)
};
oBox1.onmouseout=function(){
timer = setInterval(next, 1500);
};
})();
(function(){
var oBox2 = getByClass(document,"box2")[0];
var oUl = oBox2.children[0].children[0];
var aLi = oBox2.children[1].children[1].children;
var oSpan = oBox2.children[1].children[0];
var Now = 0;
for (var i = 0; i < aLi.length; i++) {
(function(index){
aLi[i].onmouseover=function(){
Now = index;
tab();
};
})(i);
};
function next(){
Now++;
Now == aLi.length && (Now=0);
tab();
}
var timer = setInterval(next , 1000);
function tab(){
for (var i = 0; i < aLi.length; i++) {
aLi[i].className='';
};
aLi[Now].className='active';
move(oUl,{top:-Now*oUl.children[0].offsetHeight});
move(oSpan,{top:Now*55})
};
oBox2.onmouseover=function(){
clearInterval(timer);
};
oBox2.onmouseout=function(){
timer = setInterval(next, 1000);
};
})();
(function(){
var oBox = getByClass(document,"box3")[0];
var oPrev = oBox.children[0];
var oNext = oBox.children[1];
var aLi = oBox.children[2].children;
var oUl = oBox.children[3]
var oUlLi = oUl.children;
var now = 0;
var ready = true;
var fx = Tween.Linear;
oUl.innerHTML+=oUl.innerHTML;
oUl.style.width = oUl.children.length*oUl.children[0].offsetWidth+"px";
for (var i = 0; i < aLi.length; i++) {
aLi[i].index = i;
aLi[i].onclick=function(){
if(!ready)return;
now= this.index;
tab();
};
};
function next(){
now++;
tab();
}
oNext.onclick=function(){
if(!ready)return;
ready = false;
next();
};
function tab(){
for (var i = 0; i < aLi.length; i++) {
aLi[i].className="";
};
if(now==aLi.length){
aLi[0].className="active";
}else{
aLi[now].className="active";
}
ready = false;
move(oUl,{left:-now*oUlLi[0].offsetWidth},{easing:fx,complete:function(){
ready = true;
if(now==aLi.length){
oUl.style.left=0;
now=0;
}
}});
};
oPrev.onclick=function(){
if(!ready)return;
if(now==0){
now = aLi.length-1;
oUl.style.left = -oUl.offsetWidth/2+"px";
}else{
now--;
}
tab();
};
var timer = setInterval(next, 1500);
oBox.onmouseover=function(){
clearInterval(timer);
}
oBox.onmouseout=function(){
timer = setInterval(next, 1500);
}
})();
});