JQuery Detect Scroll at Bottom

后端 未结 10 740
南方客
南方客 2021-01-30 09:58

I wish to achieve content load when the user scrolls to the bottom of the page.

I am having a problem. It works fine on desktop browsers but not on mobile. I have imple

10条回答
  •  遥遥无期
    2021-01-30 10:16

    If you can, you should really avoid trying to hit an exact number.

    Using Stelok's function above, you can test like this:

    if ($win.height() + $win.scrollTop() > (getDocumentHeight()-10)) {
    

    It's a bit softer - the user may not have quite scrolled to the exact last pixel but thinks he/she is at the bottom.

提交回复
热议问题