From 8e241cc6e9e8aec3d90dd658dfd3f182f8919e95 Mon Sep 17 00:00:00 2001 From: Mariia Shabelnik Date: Mon, 5 May 2025 20:57:53 +0200 Subject: [PATCH] fix contacty --- src/components/ScrollToAnchor.jsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/ScrollToAnchor.jsx b/src/components/ScrollToAnchor.jsx index 94ce072..6db8577 100644 --- a/src/components/ScrollToAnchor.jsx +++ b/src/components/ScrollToAnchor.jsx @@ -9,10 +9,17 @@ function ScrollToAnchor() { // https://jasonwatmore.com/react-router-v6-listen-to-location-route-change-without-history-listen useEffect(() => { if (location.hash) { - lastHash.current = location.hash.slice(1); // safe hash for further use after navigation + lastHash.current = location.hash.slice(1); } - if (lastHash.current && document.getElementById(lastHash.current)) { + if (lastHash.current === "contact") { + // Scroll to bottom of the page + window.scrollTo({ + top: document.documentElement.scrollHeight, + behavior: "smooth" + }); + lastHash.current = ""; + } else if (lastHash.current && document.getElementById(lastHash.current)) { setTimeout(() => { document .getElementById(lastHash.current)