- <script src="load_more.js"></script>
- //滚动事件触发代码如下
- <script>
- var timer=null;
- function load_more_start(){
- clearTimeout(timer);
- timer=setTimeout(function(){
- load_more.start(function(){
- // 加载更多内容获取
- });
- },200);
- }
- window.οnscrοll=function(){
- load_more_start();
- }
- </script>
微信失败 下面方法处理
//下面防抖和节流处理
var timer=null;
function load_more_start(){
clearTimeout(timer);
timer=setTimeout(function(){
getNewsInfo();
},200);
}
//评论加载更多
window.addEventListener('scroll', function(){
if (document.body.offsetHeight - window.innerHeight - document.documentElement.scrollTop < 1 || document.body.offsetHeight - window.innerHeight - document.body.scrollTop < 1){
load_more_start();
}
})