Listening to all scroll events on a page

后端 未结 4 952
借酒劲吻你
借酒劲吻你 2021-02-07 02:39

Background:

I\'m writing a component that opens up a sub-menu on click. I can\'t know where this component will be placed on the page or how far it will

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-07 02:58

    How about listing on all elements and the window?

    $('*').add(window).scroll(function() {
        console.log('scroll');
    });
    

提交回复
热议问题