Simple customizable Vanilla JS back to top arrow.
npm i back-to-top-arrow
import backToTop from 'back-to-top-arrow';
import './node_modules/back-to-top-arrow/back-to-top.css';
backToTop();
Function can take 4 arguments, if none are passed, default values are used.
No. | Property | Default | Type | Description |
---|---|---|---|---|
1. | Depth | 0.4 | Number | Scroll depth at which the arrow appears (0 - 1) |
2. | Background color | #a8a7a | String | Color of the background area |
3. | Background on hover | #ebe8e8 | String | Color of the background area on hover |
4. | Arrow color | #1f1e1e | String | Color of the arrow |
backToTop(0.6, '#000', '#2e2d2d', '#fff');