Skip to content

Commit

Permalink
math.floor()
Browse files Browse the repository at this point in the history
  • Loading branch information
elclandestin0 committed Jan 10, 2025
1 parent 8af3242 commit 506d796
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -111,7 +112,7 @@ const LandingPage: React.FC = () => {
)}
</div>
</div>
<div ref={footerRef} >
<div ref={footerRef}>
<Footer />
</div>
</div>
Expand Down

0 comments on commit 506d796

Please sign in to comment.