From 7e1d2ec2286b972665690a820caf84c478ee100e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Willian=E5=A8=81=E5=BB=89?= <1410432625@qq.com> Date: Tue, 6 Jul 2021 10:06:31 +0000 Subject: [PATCH] =?UTF-8?q?update=20=5Fscripts/scrollTo.js.=20=E5=BA=94?= =?UTF-8?q?=E6=80=A5=E7=89=88=E6=9C=AC=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=A4=A7?= =?UTF-8?q?=E5=A4=9A=E9=A1=B5=E9=9D=A2=E9=87=8D=E5=88=B7=E9=97=AE=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _scripts/scrollTo.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/_scripts/scrollTo.js b/_scripts/scrollTo.js index d8710f3..410d9d4 100644 --- a/_scripts/scrollTo.js +++ b/_scripts/scrollTo.js @@ -11,19 +11,28 @@ if(location.hash.indexOf('?')>-1) { if(surlp[0] === 'id') { - if(parseInt(window.pageYOffset) < window.document.getElementById(decodeURI(surlp[1])).offsetTop) + // console.log(parseInt(window.pageYOffset), window.document.getElementById(decodeURI(surlp[1])).offsetTop) + // console.log(parseInt(window.document.body.scrollHeight)-parseInt(window.document.body.clientHeight)) + + if(parseInt(window.pageYOffset)!==0 && parseInt(window.pageYOffset) < window.document.getElementById(decodeURI(surlp[1])).offsetTop) { var setT = setTimeout(function(){ location.reload(); if(parseInt(window.pageYOffset) >= window.document.getElementById(decodeURI(surlp[1])).offsetTop) clearTimeout(setT); },500); - // console.log(parseInt(window.pageYOffset), window.document.getElementById(decodeURI(surlp[1])).offsetTop) // console.log(parseInt(window.pageYOffset) < window.document.getElementById(decodeURI(surlp[1])).offsetTop) + console.log(parseInt(window.document.body.scrollHeight)-parseInt(window.document.body.clientHeight),parseInt(window.document.getElementById(decodeURI(surlp[1])).offsetTop)) + //页面全高-屏幕高度如果大于滚动栏高度,则清除滚动 + if(parseInt(window.document.body.scrollHeight)-parseInt(window.document.body.clientHeight)