Detect end of horizontal scrolling div with jQuery

前端 未结 3 1156
终归单人心
终归单人心 2020-12-16 05:15

So, I\'ve got some data tossed in a div. It\'s split up into chunks by date. It scrolls horizontally with the use of jQuery and the mousewheel plugin.

I need to fire

3条回答
  •  我在风中等你
    2020-12-16 05:58

    Hey, I've prepared a page for you with the implementation. You can see how to detect the end of scrolling area with jQuery.

    For the document as a whole you must detect in javascript whether .scrollTop has become equal to .scrollHeight. With jQuery it would be to detect:

    if ( $(document).scrollTop() == ( $(document).height() - $(window).height() ) {
      // Do something here ...
    }
    

    The same is done for width. Have a look on example with div here.

提交回复
热议问题