10 lines
251 B
JavaScript
10 lines
251 B
JavaScript
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')
|
|
}
|
|
} |