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

The following has been tested, and works fine:

$(window).scroll(function() {
  if ($(window).scrollTop() == $(document).height() - $(window).height()) {
    loadMore();
  }
});

Leave a Comment