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

后端 未结 8 781
梦毁少年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:01

    Your math is wrong, your saying if the scrollbar position is equal to the height of the column minus the height of the column (which equals zero) load more. that's why your loadMore() is called at the top of your col.

    Try:

    $('#col2').scroll(function(){
        if ($('#col2').scrollTop() == $('#col2').height()){
           loadMore();
        }
    });
    

提交回复
热议问题