@internetguru/scrolltopable

0.4.0 • Public • Published

GitHub Workflow Status GitHub npm GitHub file size in bytes

Scrolltopable

Scrolltopable is a JavaScript module that provides ultimate scroll-to-top functionality. No dependencies and frameworks, pure JavaScript!

See our demo.

Simple Usage

<head>
  <!-- include basic css -->
  <link rel="stylesheet" type="text/css" href="https://unpkg.com/@internetguru/scrolltopable@latest/basic.css"/>
  <!-- include scrolltopable -->
  <script type="module" src="https://unpkg.com/@internetguru/scrolltopable@latest/index.min.js"></script>
  <!-- initialization with modifying default options -->
  <script type="module">
    import { Scrolltopable } from './index.min.js'
    Scrolltopable.init({
      text: '⌃',
      hideTop: 0,
    })
  </script>
</head>

Note: you can install package locally by running npm i @internetguru/scrolltopable --save.

Options

Configuration name Default value Description
Config.text ^ Text or HTML to be inserted into main element
Config.title Top Button title
Config.hideTop 500 Position in px from the top of the page where button will be hidden
Config.showBottom 500 Position in from the bottom of the page where button will be shown
Config.deltaUpShow 200 Scroll up delta in px which show button
Config.deltaDownHide 200 Scroll down delta in px which hide button
Config.activeTimeout 0 For how long time in ms button should have activeClass and be visible after click on button
Config.scrollActionTimeout 200 For how long should be processing scroll delayed after stop scrolling
Config.ns js-scrolltopable Button id and prefix for classes
Config.extraClass noprint Button extra class(es)
Config.visibleClass ${Config.ns}--visible Class for visible button
Config.activeClass ${Config.ns}--active Class for active button (activeTimeout > 0)

Maintainers

Contributing

Pull requests are welcome, don't hesitate to contribute.

Donation

If you find this program useful, please send a donation to its developers to support their work. If you use this program at your workplace, please suggest that the company make a donation. We appreciate contributions of any size. Donations enable us to spend more time working on this package, and help cover our infrastructure expenses.

If you’d like to make a donation of any value, please send it to the following PayPal address:

PayPal Donation

Since we aren’t a tax-exempt organization, we can’t offer you a tax deduction. But for all donations over 50 USD, we’d be happy to recognize your contribution on this README file for the next release.

We are also happy to consider making particular improvements or changes, or giving specific technical assistance, in return for a substantial donation over 100 USD. If you would like to discuss this possibility, write us at info@internetguru.io.

Another possibility is to pay a software maintenance fee. Again, write us about this at info@internetguru.io to discuss how much you want to pay and how much maintenance we can offer in return.

Thanks for your support!

License

MIT License

Package Sidebar

Install

npm i @internetguru/scrolltopable

Weekly Downloads

1

Version

0.4.0

License

MIT

Unpacked Size

13.4 kB

Total Files

9

Last publish

Collaborators

  • internetguru