-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs.js
More file actions
52 lines (40 loc) · 1.09 KB
/
js.js
File metadata and controls
52 lines (40 loc) · 1.09 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
function start(){
var oDiv=document.getElementById('div2'),
oU=document.getElementById('div1'),
aLi=document.getElementsByTagName('li');
for(var i=0;i<aLi.length;i++){
if(i%2==1){
aLi[i].style.left=-aLi[i].offsetWidth+'px';
}
else{
aLi[i].style.left+=aLi[i].offsetWidth+'px';
}
}
oDiv.onclick=function(){
var i=0;
var timer=setInterval(function(){
starMove(aLi[i],{left:0,opacity:1000});
i++;
if(i==aLi.length){
clearInterval(timer);
}
},77);
};
//给Li加事件
for(var i=0;i<aLi.length;i++){
aLi[i].onclick=function(){
var oSpan=document.getElementById('sp');
var i=aLi.length-1;
oSpan.innerHTML=this.children[0].innerHTML;
var timer=setInterval(function(){
var left=i%2?-aLi[i].offsetWidth:aLi[i].offsetWidth;
starMove(aLi[i],{left:left,opacity:0});
i--;
if(i==-1){
clearInterval(timer);
}
},70);
}
}
}
start();