BackTop

BackTop makes it easy to go back to the top of the page.

BackTop

When to use

When the page content is very long.
When you need to go back to the top very frequently in order to view the contents.


Basic

The most basic usage.
Scroll down to see the bottom-right red button.

Custom style

You can customize the style of the button, just note the size limit: no more than 40px * 40px.

API

PropertyDescriptionTypeDefault
target
specifies the scrollable area dom node
() => HTMLElement
() => window
visibilityHeight
the BackTop button will not show until the scroll height reaches this value
number
400
onClick
a callback function, which can be executed when you click the button
Function
-