Load more content when scrolling down

$(function(){
    $(window).scroll(function() {
           var scrollTop = $(this).scrollTop(),scrollHeight = $(document).height(),windowHeight = $(this).height();
            var positionValue = (scrollTop + windowHeight) - scrollHeight;
            if (positionValue == 0) {
                 //do something
            }
    });
});


Do something is the function that needs to be executed. If you want to load more content, you can send a post request to the background system to get more data. If there is no data, it will give a corresponding prompt. This is more user-friendly.

Guess you like

Origin blog.csdn.net/weixin_41653910/article/details/87722738