I have a simple nav menu opened from a burger. Whilst this is open how can I prevent all scrolling on the screen? The nav bar is 100vh and I want to prevent scrolling past it whilst it is open?
Js for the nav menu so far (nothing for scrolling)
const navSlide = () => {
const burger = document.getElementById('burger')
const nav = document.getElementById('nav')
const navLinks = document.querySelectorAll('.nav-links li')
burger.addEventListener('click', () => {
nav.classList.toggle('nav-active')
navLinks.forEach( (link, index) => {
if (link.style.animation) {
link.style.animation = ''
} else {
link.style.animation = `navLinkFade 0.7s ease forwards ${index / 7 + 0.4}s`
}
})
burger.classList.toggle('toggle')
})
}
navSlide()