I want to disable scrolling for the time the next page is being loaded. I use the following combination for that
01.
private readonly preventDefault =
function
(e) {
02.
e.preventDefault();
03.
e.stopPropagation();
04.
};
05.
06.
private disableScrolling() {
07.
window.addEventListener(
'wheel'
,
this
.preventDefault, {passive:
false
});
08.
window.addEventListener(
'mousewheel'
,
this
.preventDefault, {passive:
false
});
09.
window.addEventListener(
'scroll'
,
this
.preventDefault, {passive:
false
});
10.
console.log(
'scrolling disabled'
);
11.
}
However, the scrolling is disabled after I stop rotating my mouse wheel only. Then, If I start rotating it again, the scrolling will be prevented. But if I don't stop rotating for the first time, the grid will scroll further regardless of the new attached event listeners. What am I doing wrong and how such behaviour can be explained?