jquery判断页面滚动条到底部

jquery判断页面滚动条到底部:

$(window).scroll(function(){
  var scrollTop = $(this).scrollTop();
  var scrollHeight = $(document).height();
  var windowHeight = $(this).height();
  if(scrollTop + windowHeight == scrollHeight){
   alert("到底部了");
  }
});

不需要jquery.js判断页面滚动条滚动到底部:

window.onscroll=function(){
	var a = document.documentElement.scrollTop==0? document.body.clientHeight : document.documentElement.clientHeight;
	var b = document.documentElement.scrollTop==0? document.body.scrollTop : document.documentElement.scrollTop;
	 var c = document.documentElement.scrollTop==0? document.body.scrollHeight : document.documentElement.scrollHeight;
	 if(a+b==c){
             alert("到底部了");                                   
	 }
};
正在加载评论...