From 6ecb27ffa790edc1d970cc3efd1e605bd6766de3 Mon Sep 17 00:00:00 2001 From: Malaber Date: Fri, 14 Mar 2025 22:47:37 +0100 Subject: [PATCH] Finetuning scroll to top button --- js/components/ScrollToTopButton.js | 39 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/js/components/ScrollToTopButton.js b/js/components/ScrollToTopButton.js index 4548ae4..14f42ec 100644 --- a/js/components/ScrollToTopButton.js +++ b/js/components/ScrollToTopButton.js @@ -8,7 +8,7 @@ export function ScrollToTopButton() { useEffect(() => { const handleScroll = () => { - if (window.scrollY > 2 * window.innerHeight) { + if (window.scrollY > 1.5 * window.innerHeight) { setIsVisible(true); } else { setIsVisible(false); @@ -23,23 +23,22 @@ export function ScrollToTopButton() { }; return ( - <> - {isVisible && ( - - )} - + ); -} +} \ No newline at end of file