Skip to content

🎢 Simple scroll to top function. No dependencies.

License

Notifications You must be signed in to change notification settings

iagodahlem/roll.js

Repository files navigation

roll.js

Simple scroll to top function. No dependencies.

Install

You can get it on npm.

npm install roll.js

Or using yarn.

yarn add roll.js

Setup

You can import it using ES6 Modules.

import roll from 'roll.js'

Or using CommonJS.

const roll = require('roll.js')

If you are not using a bundler, just include the script located in the dist folder.

<script src="dist/roll.min.js"></script>

Usage

Now, all you need to do is call the roll function into your desired event.

const button = document.querySelector('button')

button.addEventListener('click', () => {
  roll()
})

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT License © Iago Dahlem

About

🎢 Simple scroll to top function. No dependencies.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published