-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.js
59 lines (46 loc) · 1.72 KB
/
main.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
var acc = document.getElementsByClassName("footer-h4-div");
var i;
const hamburger = document.querySelector(".hamburger");
const navMenu = document.querySelector(".nav-menu");
const cart = document.querySelector(".cart");
const icon = document.querySelector(".menu-div");
hamburger.addEventListener("click", mobileMenu);
function mobileMenu() {
hamburger.classList.toggle("active");
navMenu.classList.toggle("active");
cart.classList.toggle("none");
icon.classList.toggle("close");
}
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function () {
/* Toggle between adding and removing the "active" class,
to highlight the button that controls the panel */
this.classList.toggle("active");
/* Toggle between hiding and showing the active panel */
var panel = this.nextElementSibling;
if (panel.style.display === "block") {
panel.style.display = "none";
} else {
panel.style.display = "block";
}
});
}
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
var panel = this.nextElementSibling;
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
});
}
var limitFunc = function () {
if (window.innerWidth > 880) {
/*your functions for big screen*/
window.location.reload(true);
// window.location.href = "/#footer";
}
};
window.addEventListener("resize", limitFunc);
window.addEventListener("onload", limitFunc);