From 506d796b1fa0ff4965fbdcc76b4efe9261aa9f1f Mon Sep 17 00:00:00 2001 From: Memo Khoury Date: Fri, 10 Jan 2025 19:04:39 +0000 Subject: [PATCH] math.floor() --- .../src/pages/LandingPage/LandingPage.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webapps/world-builder-dashboard/src/pages/LandingPage/LandingPage.tsx b/webapps/world-builder-dashboard/src/pages/LandingPage/LandingPage.tsx index c1bb5406..86afe392 100644 --- a/webapps/world-builder-dashboard/src/pages/LandingPage/LandingPage.tsx +++ b/webapps/world-builder-dashboard/src/pages/LandingPage/LandingPage.tsx @@ -37,11 +37,12 @@ const LandingPage: React.FC = () => { if (!element) return; const handleScroll = () => { - const isAtBottom = element.scrollHeight - element.scrollTop === element.clientHeight; + const isAtBottom = Math.floor(element.scrollHeight - element.scrollTop) === Math.floor(element.clientHeight) + console.log(isAtBottom) if (isAtBottom) { - footerRef.current?.scrollIntoView({ behavior: 'smooth' }); + footerRef.current?.scrollIntoView({ behavior: 'smooth' }) } - }; + } element.addEventListener('scroll', handleScroll); return () => element.removeEventListener('scroll', handleScroll); @@ -111,7 +112,7 @@ const LandingPage: React.FC = () => { )} -
+