滚动事件

$(window).bind("scroll", scrollFn);  //绑定滚动事件 

function scrollFn() {
  //真实内容的高度
  var pageHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight);
  //视窗的高度
  var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
  //隐藏的高度
  var scrollHeight = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
  if (flagNoData) { //数据全部加载完了
    return;
  } else if (pageHeight - viewportHeight - scrollHeight < 10) {  //如果满足触发条件,执行
     if(flag){
         if($("#dixian").val()==2){
      $(".container").append(loadimage);        
       showAjax(page,type);
         }
     }
  }
}

猜你喜欢

转载自blog.csdn.net/yangmy_Shy/article/details/89213188