-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
56 lines (49 loc) · 1.44 KB
/
app.js
File metadata and controls
56 lines (49 loc) · 1.44 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
const changerTab = document.querySelectorAll("h4");
const tabS = document.querySelectorAll(".tab");
const faqs = document.querySelectorAll("li")
const switcher = document.querySelector(".switcher")
const hamburger = document.querySelector(".hamburger")
const cross = document.querySelector(".close")
const nav = document.querySelector("nav")
let pos = 0;
//TAB SYSTEM
changerTab.forEach((item) => {
item.addEventListener("click", () => {
if (item.classList.contains("bottom-bar")) {
return false;
} else {
item.classList.add("bottom-bar");
}
pos = item.getAttribute("data-nav");
for (let i = 0; i < changerTab.length; i++) {
if (changerTab[i].getAttribute("data-nav") != pos) {
changerTab[i].classList.remove("bottom-bar");
}
}
for (let j = 0; j < tabS.length; j++) {
if (tabS[j].getAttribute("data-nav") == pos) {
tabS[j].classList.add("tabActive");
} else {
tabS[j].classList.remove("tabActive");
}
}
});
});
//FAQS SYSTEM
faqs.forEach(item => {
item.addEventListener("click", () => {
item.classList.toggle("active")
})
})
//NAV MOBILE
switcher.addEventListener("click", () => {
if (hamburger.classList.contains("index")) {
hamburger.classList.remove("index")
cross.classList.add("index")
nav.classList.remove('display')
} else {
hamburger.classList.add("index")
cross.classList.remove("index")
nav.classList.add('display')
}
})