npm.io
4.6.19 • Published 2 years ago

exizt.scroll-top

Licence
MIT
Version
4.6.19
Deps
0
Size
17 kB
Vulns
0
Weekly
0

ScrollTop JS

The script that creates an arrow in the bottom-right corner of the screen to scroll back to the top.

Download and Setup

  1. Download and place the files in a project directory.
  2. using dist/scroll-top.mix.js file.

Usage

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>

Options

Option List

  • base: Minimum height value for symbol visibility.
    • (type number, default 100)
  • debug : debug log..
    • (type boolean, default false)

(example)

scrolltop.load({
  base:300
})
How to use option
html, js
<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, typescript

npm

npm install --save-dev exizt.scroll-top

TypeScript

import { ScrollTop } from 'exizt.scroll-top'
const scrolltop = new ScrollTop()
scrolltop.load()

License

MIT License