Capturing the “scroll down” event?

后端 未结 10 2182
闹比i
闹比i 2020-12-28 12:17

I\'m designing a very simple web page (HTML only), the only \"feature\" I want to implement is to do something when the user scrolls down the page, is there a way to capture

10条回答
  •  失恋的感觉
    2020-12-28 12:56

    A better way is to not only check for scroll events but also for direction scrolling like below;

    $(window).bind('mousewheel', function(event) {
    if (event.originalEvent.wheelDelta >= 0) {
        console.log('Scroll up');
    }
    else {
        console.log('Scroll down');
    }
    });
    

提交回复
热议问题