Community forum for knowledge and support

Updated 6 months ago

Adding an up-to-top button for a specific section

At a glance

The community member is looking for the easiest way to add an up-to-top button that scrolls to the top of a specific section, not the entire page. In the comments, another community member suggests adding an id to the target section and using that as the link for the button. Another community member asks how to control when the button appears and disappears, and a third community member recommends listening to the scroll event and calculating the offset from the top to determine when the button should be visible.

What's the easiest way to add an up-to-top button?
I don't want it to go to the top of the page but to the top of the section. Thanks

V
S
3 comments

Add an id to the section you want to go to and add the section's id as the link to the button. If that's what you are asking. πŸ˜€

Example

If not, Could you elaborate? 😁

Thank you! What is the best way to control when the button appears and disappears?

you can listen scroll event and calculate the offset from top to calculate when the button should be visible
Check here
Scroll to top

Add a reply
Sign up and join the conversation on Slack