-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnav.js
61 lines (54 loc) · 1.86 KB
/
nav.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
/**
* Created by Administrator on 2016/9/4 0004.
*/
function nav() {
var oMenu = document.getElementsByClassName('channel');
var oUla = document.getElementsByClassName('ula');
var oLia = document.getElementsByClassName('lia');
var len= oMenu.length;
var timer = null;
function menu() {
for (var i= 0; i < len; oMenu[i].id = i, oLia[i].id=i,i++) {
oMenu[i].onmouseover = function () {
if (!(this.className == 'channel hovered')) {
this.className = 'channel hover';
}
for (var i = 0; i < len; i++){
oUla[i].style.display = 'none';
}
};
oMenu[i].onmouseout = function () {
if (!(this.className == 'channel hovered')) {
this.className = 'channel hover1';
}
};
oLia[i].onmouseover = function () {
var that = this;
if(timer){
clearTimeout(timer);
}
timer=setTimeout(function () {
oUla[that.id].style.display = 'block';
},500);
};
oLia[i].onmouseout = function () {
var that = this;
if(timer) {
clearTimeout(timer);
timer=setTimeout(function () {
oUla[that.id].style.display = 'none';
},500);
}
};
oMenu[i].onclick = function () {
if (!(this.className == 'channel hovered')) {
for (var j = 0; j < len; j++) {
oMenu[j].className = 'channel hover1';
}
}
this.className = 'channel hovered';
};
}
}
menu();
}