js实现滑动自动加载数据


js实现滑动自动加载数据

window.BfwOnscroll= function(){
    var scrollTop = document.documentElement.scrollTop||document.body.scrollTop;

     if(that.loadingdata){
	 return;
      }
	 var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
	 var scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight;

	if(scrollTop+windowHeight>=scrollHeight-60){//判断高度是否离底部60像素
		 loadingdata=true;
		 loadmore();
	}   
 }

{{collectdata}}

网友评论0