-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (18 loc) · 784 Bytes
/
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
'use strict';
const nav = document.querySelector('.mobile-nav');
const navMenuBtn = document.querySelector('.nav-menu-btn');
const navCloseBtn = document.querySelector('.nav-close-btn');
const navToggleFunc = function () { nav.classList.toggle('active'); }
navMenuBtn.addEventListener('click', navToggleFunc);
navCloseBtn.addEventListener('click', navToggleFunc);
const themeBtn = document.querySelectorAll('.theme-btn');
for (let i = 0; i < themeBtn.length; i++) {
themeBtn[i].addEventListener('click', function () {
document.body.classList.toggle('light-theme');
document.body.classList.toggle('dark-theme');
for (let i = 0; i < themeBtn.length; i++) {
themeBtn[i].classList.toggle('light');
themeBtn[i].classList.toggle('dark');
}
})
}