0.0.9 • Published 2 years ago

rc-backtotop v0.0.9

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
2 years ago

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