优化 滚动到隐藏内容处的代码(不使用我的美化脚本也支持了)

This commit is contained in:
xiu2
2021-02-21 11:07:15 +08:00
parent 1311baa352
commit 5b4ca30e38
+1 -11
View File
@@ -208,12 +208,7 @@
// 存在隐藏内容,自动回复
if (document.getElementsByClassName("showhide").length == 0){
writeReply();
// 如果使用了我的智友帮美化脚本,则定位至底部,反之定位至顶部
if (document.getElementById("fastpostmessage").offsetParent == null){
setTimeout(`window.scrollTo(0,99999999)`, 1000);
}else{
setTimeout(`window.scrollTo(0,0)`, 1000);
}
setTimeout(`window.scrollTo(0,document.querySelector('.showhide').offsetTop)`, 1000);
}
}
}
@@ -240,12 +235,7 @@
// 如果已显示隐藏内容,则定位到隐藏内容区域
// 如果没有发现已显示隐藏内容,就不定位了
if (document.getElementsByClassName("showhide").length > 0){
// 如果使用了我的智友帮美化脚本,则定位至底部
/*if (document.getElementById("fastpostmessage").offsetParent == null){
//setTimeout(`window.scrollTo(0,99999999)`, 1000);
}*/
setTimeout(`window.scrollTo(0,document.querySelector('.showhide').offsetTop)`, 500);
//setTimeout(`location.hash='#footer'`, 1000);
}
}
}