jQuery: detecting reaching bottom of scroll doesn't work, only detects the top

后端 未结 8 801
梦毁少年i
梦毁少年i 2020-12-01 11:44

So basically my problem is a seemingly simple one.

You can see it in action at http://furnace.howcode.com (please note that data is returned via Ajax, so if nothing

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 12:15

    I found an alternative that works.

    None of these answers worked for me (currently testing in FireFox 22.0), and after a lot of research I found, what seems to be, a much cleaner and straight forward solution.

    Implemented solution:

    function IsScrollbarAtBottom() {
        var documentHeight = $(document).height();
        var scrollDifference = $(window).height() + $(window).scrollTop();
        return (documentHeight == scrollDifference);
    }
    

    Resource: http://jquery.10927.n7.nabble.com/How-can-we-find-out-scrollbar-position-has-reached-at-the-bottom-in-js-td145336.html

    Regards

提交回复
热议问题