-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (28 loc) · 1.01 KB
/
index.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
document.querySelector('.navbar .menu-btn').addEventListener('click', () => {
document.querySelector('.navbar .links ul').classList.toggle("active");
document.querySelectorAll('.menu-btn i').forEach((e) => {
e.classList.toggle("active")
})
})
document.addEventListener("scroll", () => {
if (this.scrollY > 20) {
document.querySelector('.navbar').classList.add("active")
} else {
document.querySelector('.navbar').classList.remove("active")
}
})
// Get all the buttons
const btn = document.querySelectorAll('.btn');
// Add event listener to each button
btn.forEach(element => {
element.addEventListener('click', () => {
// Remove "active" class from all buttons
btn.forEach(el => el.classList.remove('active'));
// Add "active" class to the clicked button
element.classList.add('active');
});
});
// Pre-Loader
window.onload = function () {
document.querySelector('.loader-bg').style.display = 'none';
}