浏览器设置页面自动滚动

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 20:32   3012   0

有些时候我们会想让浏览器自动滚动模拟真人浏览行为

打开浏览器控制台,切换到Console控制台![在这里插入图片描述](https://img-blog.csdnimg.cn/20190531190950706.png

var i=0;
setInterval(function(){
if(
document.documentElement.scrollTop+
document.documentElement.clientHeight>=
document.documentElement.offsetHeight
){
window.scrollTo(0,0);
i=0;
}else{
window.scrollTo(0,(document.body.scrollHeight/1800)*i);
}
i++;
console.log(i);
},1000);

改进了大佬的代码,跳转到底部自从回顶部

https://blog.csdn.net/weixin_43619065/article/details/90721679老版本大佬的地址

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP