JS判断是否到达页面底部

<script type="text/javascript">
//判断整个文档到底部
$(window).scroll(function(){
    //滚动条所在位置的高度
    totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
    //当前文档高度   小于或等于   滚动条所在位置高度  则是页面底部
    if(($(document).height()) <= totalheight) {
        //页面到达底部
    }
});

//判断某个盒子到底部
//加载分页的排行
$('#showRankbox').scroll(function(){
    var $this = $(this)
    totalheight = parseFloat($this.height()) + parseFloat($this.scrollTop());
    if($this.find(' > ul').height() <= totalheight+2) {
        rankPage++;
        //到达底部加载更多列表
    }
})
</script>

每天进步一点点~~~
原文地址:https://www.cnblogs.com/heshimei/p/8109922.html