1、html,body{width:100%;height:100%;} 无法触发onscroll和scroll 即jq和js都不会触发scroll事件!
所以,height:100%,必须去掉,否则不会触发scroll事件
2、由以下代码即可
$(window).scroll(function(){
var scrollTop = $(this).scrollTop();
var scrollHeight = $(document).height();
var windowHeight = $(this).height();
console.log("scrollTope:"+scrollTop);//滚动条高度 console.log("scrollHeighte:"+scrollHeight);//文档的总高度 console.log("windowHeighte:"+windowHeight);//可视高度
///若文档的总高度 和可视高度+滚动高度相同,就加载
if(scrollTop + windowHeight == scrollHeight){
alert("到底部的操作");
}
});