button collapsing with footer

I have a scroll to top button in my React web app. I want to position it further from the bottom whenever it reaches the footer. So it wont be collapsing with footer and block the links in mobile view. Can you help me how can i achieve this
No description
3 Replies
Joao
Joao14mo ago
You can have use something like intersection observer to check how far down the page you've scrolled and adjust the styling accordingly. https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver
ἔρως
ἔρως14mo ago
also, consider using a negative margin top for the intersection detection, and transition the bottom position, so it doesnt look super janky
Want results from more Discord servers?
Add your server