How To Prevent Body From Scrolling When Navigation Menu Is Open
If you want to know how to prevent the body from scrolling when a modal window is open, this custom code will do just that. This snippet works when you use Webflow’s Navbar Component and will prevent the page from scrolling when it is open
The custom code is long because there is a bug when iOS doesn’t prevent users from scrolling past the modal if there is content that exceeds the viewport height, despite adding overflow: hidden in the CSS.
iOS bug created in 2016 was solved only in May 2019 but they have no idea when it will be released.https://bugs.webkit.org/show_bug.cgi?id=153852
So the code is updated with additional enhancement which detects the device's OS and makes a bit of a different approach if it is iOS.
Publish the site and test it :)