Scroll event for Meteor

后端 未结 5 1788
没有蜡笔的小新
没有蜡笔的小新 2021-02-07 20:29

I couldn\'t find a scroll event for meteor in the meteor docs. How do I go about doing something as someone scrolls the window down in a meteor application?

I\'ve tried

5条回答
  •  没有蜡笔的小新
    2021-02-07 21:21

    As a partial solution, you can listen for the mousewheel event on whatever element you care about. A lot of times this is exactly what you want anyways.

    As an example, the following event listener will prevent the user from scrolling with the scroll wheel at all, but they will still be able to use the navigation bar on the side of the page. (If you have not disabled it with overflowy: hidden;)

    Template.body.events({
        'mousewheel': function(event, template) {
            console.log("scrolled");
            return false;
        }
    });
    

提交回复
热议问题