You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
251 B
10 lines
251 B
4 years ago
|
const nav = document.querySelector('.nav')
|
||
|
window.addEventListener('scroll', fixNav)
|
||
|
|
||
|
function fixNav() {
|
||
|
if(window.scrollY > nav.offsetHeight + 150) {
|
||
|
nav.classList.add('active')
|
||
|
} else {
|
||
|
nav.classList.remove('active')
|
||
|
}
|
||
|
}
|