-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfooter.js
42 lines (37 loc) · 1.07 KB
/
footer.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
var footer_left = document.getElementsByClassName("footer-left");
var width = window.screen.width;
function haveActive(footer_left) {
for(var i=0;i<footer_left.classList.length;i++) {
if(footer_left.classList[i] == "active")
return true;
}
return false;
}
function checkActiveFooter() {
for(var i=0;i<footer_left.length;i++) {
if(haveActive(footer_left[i]))
return i;
}
return -1;
}
function checkFooter(width) {
if(width >= 701) {
if(checkActiveFooter() == 0) {
footer_left[0].classList.remove("active");
footer_left[0].classList.add("not-active");
footer_left[1].classList.add("active");
}
}
else if(width <= 700) {
if(checkActiveFooter() == 1) {
footer_left[1].classList.remove("active");
footer_left[1].classList.add("not-active");
footer_left[0].classList.add("active");
}
}
}
checkFooter(width);
window.setInterval(function() {
width = window.screen.width;
checkFooter(width);
}, 50);