鼠标轮滚过快就执行了2次document.title +=ss;如果点击滚动条手动拉动的话就正常有什么办法解决吗?
2 回答
HUWWW
TA贡献1874条经验 获得超12个赞
var throldHold = 20; //两次scroll事件触发之间最小的事件间隔window.onscroll = function(){ if(arguments.callee.timer) clearTimeout(arguments.callee.timer);
arguments.callee.timer = setTimeout(function(){ var tops =0; if(document.body.scrollTop){
tops = document.body.scrollTop;
} else{
tops = document.documentElement.scrollTop;
}
if(tops >= document.documentElement.scrollHeight - document.documentElement.clientHeight){ var ss="1";
document.title +=ss;
}
},throldHold);
}- 2 回答
- 0 关注
- 664 浏览
添加回答
举报
0/150
提交
取消
