79263138

Date: 2024-12-08 18:57:51
Score: 1
Natty:
Report link

Starting with version 52, Chrome introduced an optional support flag, and soon default support, for passive scroll event listeners, so according to this document, for disable scroll it's enough to specify that your event handler is not passive (passive: false):

    window.addEventListener('mousewheel', e => {
      e.preventDefault();
      yourCustomFn();
    }, { passive: false })

NOTE: for old browsers you need to use polyfill

Reasons:
  • Blacklisted phrase (1): this document
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: DraKoan