jQuery load more data on scroll

前端 未结 9 1083
夕颜
夕颜 2020-11-22 10:44

I am just wondering how can i implement more data on scroll only if the div.loading is visible.

Usually we look for page height and scroll height, to see if we need

9条回答
  •  清歌不尽
    2020-11-22 11:21

    The accepted answer of this question has some issue with chrome when the window is zoomed in to a value >100%. Here is the code recommended by chrome developers as part of a bug i had raised on the same.

    $(window).scroll(function() {
      if($(window).scrollTop() + $(window).height() >= $(document).height()){
         //Your code here
      }
    });
    

    For reference:

    Related SO question

    Chrome Bug

提交回复
热议问题