From 0fcaf795fe022ef35c29bfacb1bf84b8944156d0 Mon Sep 17 00:00:00 2001 From: Raj-Mandal-20 Date: Wed, 15 May 2024 02:27:31 +0530 Subject: [PATCH] fixed backToTopButton hook --- .../src/hooks/useBackToTopButton.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/docusaurus-theme-common/src/hooks/useBackToTopButton.ts b/packages/docusaurus-theme-common/src/hooks/useBackToTopButton.ts index aa7e2fd7b7dc..98803d8acb0f 100644 --- a/packages/docusaurus-theme-common/src/hooks/useBackToTopButton.ts +++ b/packages/docusaurus-theme-common/src/hooks/useBackToTopButton.ts @@ -46,19 +46,12 @@ export function useBackToTopButton({ // This scroll position change is triggered by navigating to an anchor. // Ignore it. isFocusedAnchor.current = false; - } else if (scrollTop >= lastScrollTop) { - // The user has scrolled down to "fight against" the animation. Cancel any - // animation under progress. cancelScroll(); + } else if(scrollTop <= threshold && scrollTop >=0){ setShown(false); - } else if (scrollTop < threshold) { - // Scrolled to the minimum position; hide the button. - setShown(false); - } else if ( - scrollTop + window.innerHeight < - document.documentElement.scrollHeight - ) { - setShown(true); + } + else{ + setShown(true) } });