Skip to content

Commit

Permalink
fixed backToTopButton hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Raj-Mandal-20 committed May 14, 2024
1 parent ff5039f commit 0fcaf79
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions packages/docusaurus-theme-common/src/hooks/useBackToTopButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
});

Expand Down

0 comments on commit 0fcaf79

Please sign in to comment.