js 判断是否滚动到底部

            $(window).scroll(function(){
                var scrollTop = $(this).scrollTop();  //scrollTop() 方法返回或设置匹配元素的滚动条的垂直位置
                var scrollHeight = $(document).height(); //整个文档的高度
                var windowHeight = $(this).height(); //当前可见区域的大小
                if(scrollTop + windowHeight == scrollHeight){
                    alert('The page has been scrolled to the bottom')
                }
            })

 当 html,body{100%;height:100%;}  绑定在window或者body无法触发onscroll和scroll  即jq和js都不会触发scroll事件!

原文地址:https://www.cnblogs.com/AllenChou/p/6734088.html