wheel event PreventDefault does not cancel wheel event

This is fairly simple problem, store anywhere the last direction and coditionally execute your code:

direction = '';
window.addEventListener('wheel',  (e) => {
    if (e.deltaY < 0) {
      //scroll wheel up
      if(direction !== 'up'){
        direction = 'up';
    if (e.deltaY > 0) {
      //scroll wheel down
      if(direction !== 'down'){
        direction = 'down';

Anyway, the UX context should be defined. May be that throttling or debouncing your function will give better results in some scenarios.


Throttling enforces a maximum number of times a function can be called over time. As in "execute this function at most once every 100 milliseconds."


Debouncing enforces that a function not be called again until a certain amount of time has passed without it being called. As in "execute this function only if 100 milliseconds have passed without it being called.

In your case, maybe debouncing is the best option.

Temporary lock the browser scroll

$('#test').on('mousewheel DOMMouseScroll wheel', function(e) {

    return false;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="test">