滚动条下拉时加载更多内容

$(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就是需要执行的功能,要是想加载更多的内容,就可以发送post请求到后台系统获取更多数据,如果没有数据就给出相应的提示,这个更人性化。

猜你喜欢

转载自blog.csdn.net/weixin_41653910/article/details/87722738