Listening to all scroll events on a page

后端 未结 4 949
借酒劲吻你
借酒劲吻你 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 03:10

    You need to see whether scroll is happening to window level or to an element level. Usually in your case '*' should suffice.

    $('*').scroll(function() {
        alert('scroll');
    });
    

    Here is updated link: http://jsfiddle.net/wAadt/1

提交回复
热议问题