The script that creates an arrow in the bottom-right corner of the screen to scroll back to the top.
- Download and place the files in a project directory.
- using
dist/scroll-top.mix.js
file.
html
<script type="module" src="dist/scroll-top.mix.js"></script>
or
<link rel="stylesheet" href="dist/scroll-top.css">
<script type="module">
import { ScrollTop } from 'dist/scroll-top.js';
const scrolltop = new ScrollTop()
scrolltop.load()
</script>
Option List
-
base
: Minimum height value for symbol visibility.- (type
number
, default100
)
- (type
-
debug
: debug log..- (type
boolean
, defaultfalse
)
- (type
(example)
scrolltop.load({
base:300
})
<link rel="stylesheet" href="../dist/scroll-top.css">
<script type="module">
import { ScrollTop } from '../dist/scroll-top.js';
const scrolltop = new ScrollTop()
scrolltop.load()
</script>
npm
npm install --save-dev exizt.scroll-top
TypeScript
import { ScrollTop } from 'exizt.scroll-top'
const scrolltop = new ScrollTop()
scrolltop.load()
MIT License