2

if (typeof window.addEventListener === 'function') {
    window.addEventListener('scroll', demo);
}
else if (typeof window.attachEvent === 'object') {
    document.documentElement.attachEvent('onscroll', demo);
}
function demo(eve) {
    eve.preventDefault ? eve.preventDefault() : (eve.returnValue = false);
}

hi guys
how to preventDefault event when onscroll.
my code is not work.
i want to disable the scrolling, when control scroll bar & press keyboard & scrolling mouse.

i dont speak English well and i'm new to stackoverflow. Please understand XD.

msm082919
  • 617
  • 8
  • 24

0 Answers0