js prevent browser scrlling code example
Example 1: javascript disable scrolling
function disableScrolling(){
var x=window.scrollX;
var y=window.scrollY;
window.onscroll=function(){window.scrollTo(x, y);};
}
function enableScrolling(){
window.onscroll=function(){};
}
Example 2: javascript cancel scroll
const pause = (scroll) => window.clearTimeout(scroll)