-
Load the ScrollTopper-Script in your HTML
<script src="scrollTopper.js"></script>
-
Add the ScrollTopper-CSS to your HTML
<link href="scrollTopper.css" rel="stylesheet">
-
Initialize ScrollTopper in your JavaScript
new ScrollTopper()
Additionally, you can pass an object that contains additional options as a parameter.
const options = {
scrollHeight: 0
};
new ScrollTopper(options);
You can use the following options:
Number of pixels scrolled from the top of the page to display the back to top button.
Type: number
Width of the button, specified in pixels. No "px" suffix.
Type: number
Background-color of the button
Type: string