forked from hidcCombEx/SpedUp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
25 lines (21 loc) · 904 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
document.addEventListener('scroll', () => {
const header = document.getElementById('nav')
if (window.scrollY > 60) header.classList.add('white')
else header.classList.remove('white')
})
document.addEventListener("DOMContentLoaded", () => {
const toggle = document.getElementById('toggle')
toggle.addEventListener('click', function() {
const svg = document.querySelector('nav svg path')
const menu = document.querySelectorAll('nav ul li')
if (toggle.classList.contains('on-toggle')) {
toggle.classList.remove('on-toggle')
svg.style.fill = '#565656'
menu.forEach(list => { list.classList.remove('on-menu') })
} else {
toggle.classList.add('on-toggle')
svg.style.fill = '#EA4D37'
menu.forEach(list => { list.classList.add('on-menu') })
}
})
})