-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
25 lines (22 loc) · 729 Bytes
/
app.js
File metadata and controls
25 lines (22 loc) · 729 Bytes
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
const slide = () => {
const slider = document.querySelector('.slide')
const nav = document.querySelector('.nav-links')
const navlinks = document.querySelectorAll('.nav-links li')
// toggle nav
slider.addEventListener('click', () => {
nav.classList.toggle('nav-active')
slider.classList.toggle('toggle')
if(!nav.classList.contains('transform')) {
nav.classList.add('transform')
}
// animate links
navlinks.forEach((link, index) => {
if(link.style.animation) {
link.style.animation= ''
} else {
link.style.animation = `navlinkFade 0.5s ease forwards ${index/ 6}s`
}
})
})
}
slide()