rc-backtotop

0.0.9 • Public • Published

backtotop

A simple vanilla js back-to-top button.

Installation

npm install renancalmet/backtotop

Usage

In document head :

<link rel="stylesheet" href="node_modules/backtotop/backtotop.css">

At the end of <body> :

<script src="node_modules/backtotop/index.js"></script>
<script>
    const bouton = new backToTop(700, '.button');
</script>

The class parameters are :

  • 700 : the first pixel from which the backtotop button is displayed.
  • '.button' : the CSS selector to identify the button.

TODO

  • Add positioning parameters
  • Stylize appearance/disappearance
  • Make it a real node module by default exporting the class + making a dist/backtotop.js following this tutorial

Package Sidebar

Install

npm i rc-backtotop

Weekly Downloads

0

Version

0.0.9

License

GPL-3.0

Unpacked Size

38.4 kB

Total Files

5

Last publish

Collaborators

  • renancalmet