From 511be00679d372fd9839c69fe98892bc95b151ac Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 27 Oct 2021 10:53:31 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:jump-to-top=E8=A2=AB=E9=81=AE=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/JumpToTop.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/JumpToTop.js b/components/JumpToTop.js index d14ff486..18514766 100644 --- a/components/JumpToTop.js +++ b/components/JumpToTop.js @@ -20,6 +20,7 @@ const JumpToTop = ({ targetRef, showPercent = true }) => { const scrollY = window.pageYOffset const fullHeight = clientHeight - window.outerHeight const shouldShow = scrollY > 100 + console.log(clientHeight, scrollY, fullHeight, shouldShow) if (shouldShow !== show) { switchShow(shouldShow) } @@ -33,7 +34,7 @@ const JumpToTop = ({ targetRef, showPercent = true }) => { }, [show]) return ( -
+
window.scrollTo({ top: 0, behavior: 'smooth' })}