Javascript jQuery在不可滚动元素上检测滚动

Javascript jQuery在不可滚动元素上检测滚动,javascript,scroll,detect,Javascript,Scroll,Detect,我希望能够检测$.scroll()在可展开的元素上。这类元素的示例可能是带有溢出:hidden但具体来说是绝对div,宽度100%高度和宽度。 我想在此div上绑定滚动上的事件 <div id="js_bgElem" style="width: 100%; height: 100%; position: absolute;"></div> <script> $('#js_bgElem').on('scroll', function(){

我希望能够检测
$.scroll()在可展开的元素上。这类元素的示例可能是带有
溢出:hidden但具体来说是绝对div,宽度100%高度和宽度。
我想在此div上绑定滚动上的事件

<div id="js_bgElem" style="width: 100%; height: 100%; position: absolute;"></div>

<script>
    $('#js_bgElem').on('scroll', function(){
        alert('Scrolled!);
    });
</script>
从理论上讲,这是可行的,但是,它不能被点击通过。一次
指针事件:无,则不再检测到
滚动

有人能帮我吗?谢谢

<div id="js_anchor" style="width: 100%; height: 100%; position: fixed; z-index: 1; overflow: auto;">
    <div style="height: 300%"></div> <!-- Simple stretch -->
</div>

<script>
    $('#js_anchor').on('scroll', function(){
         // detect which way is scrolling
         // $(this).scrollTop(50%) so it can be scrolled infinitely
    });
</script>