-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
27 lines (18 loc) · 815 Bytes
/
script.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
window.addEventListener('scroll', () => {
let header = document.querySelector('header');
if(window.scrollY >= 100) header.classList.add('header-active');
else header.classList.remove('header-active');
});
window.addEventListener('load', () => {
let toggleButton = document.querySelector('#toggleButton');
let menuMobile = document.querySelector('.menu-mobile');
let hamburger = document.querySelector('.input-menu');
toggleButton.addEventListener('click', () => {
toggleButton.children.item(0).classList.toggle('toggleModeSun');
document.body.classList.toggle('dark-mode');
});
hamburger.addEventListener('click', () => {
menuMobile.classList.toggle('menu-mobile-active');
document.body.classList.toggle('menuActive');
})
});