js滑动到页面底部实现加载更多

 $(document).scroll(function(){
        var bheight = $(document).height();//获取窗口高度
        var sheight = $("body")[0].scrollHeight;//获取滚动条高度,[0]是为了把jq对象转化为js对象
        var stop = $("body").scrollTop();//滚动条距离顶部的距离
        if(stop>=sheight-bheight){//当滚动条到顶部的距离等于滚动条高度减去窗口高度时
            ajaxQuery();//发送请求
        }
    });

 

posted on 2017-01-21 16:11  小乔流水人家  阅读(161)  评论(0)    收藏  举报

导航