I use the following code to disable scrolling in desktop browsers but it doesn't work for iPhone screen resolution.
$("html").css("overflow", "hidden");
What else do I need to add?
To hide the horizontal scrollbar and prevent horizontal scrolling, use overflow-x: hidden: HTML. CSS.
When the mobile menu is active (overlay) want to prevent that the body is scroll able, disable scroll for body.
//target the entire page, and listen for touch events
$('html, body').on('touchstart touchmove', function(e){
//prevent native touch activity like scrolling
e.preventDefault();
});
if having the touch event blocked doesn't work for you, you can always go like this:
html, body{
max-width:100%;
max-height:100%;
overflow:hidden;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With