前段js滑动到最底端触发加载下一页的方法

  • Post author:
  • Post category:其他


window.onscroll = function () {

var top = document.documentElement.scrollTop || document.body.scrollTop;

var now=top+document.body.clientHeight;

var scrollHeight=document.body.scrollHeight;

alert(‘top+clientHeight=’+now+”,scrollHeight==”+scrollHeight);

if(now>=scrollHeight){



//加载数据

}

};



版权声明:本文为u010440155原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。