Using jQuery, I would like to disable scrolling of the body:
My idea is to:
body{ overflow: hidden;}
I think the best and clean solution is:
window.addEventListener('scroll',() => {
var x = window.scrollX;
var y = window.scrollY;
window.scrollTo(x,y);
});
And with jQuery:
$(window).on('scroll',() => {
var x = window.scrollX;
var y = window.scrollY;
window.scrollTo(x,y)
})
Those event listener should block scrolling. Just remove them to re enable scrolling