@marlospomin/smoothie
v1.0.6
Published
A vanilla smooth-scrolling javascript plugin with no dependencies.
Downloads
2
Maintainers
Readme
Smoothie
A vanilla smooth-scrolling JavaScript plugin with no dependencies.
Features
- Blazing fast. (Using scrollIntoView)
- Lightweight.
- No dependencies.
Demo
Example page on CodePen.
Install
# Using npm
npm install @marlospomin/smoothie
# Using yarn
yarn add @marlospomin/smoothie
Now include smoothie in your project and you should be good to go.
// es6
import smoothie from '@marlospomin/smoothie'
// commonjs
const smoothie = require('@marlospomin/smoothie')
Usage
Add data-smoothie
to your anchor tags and the target's id
in the href value as it follows below.
<a data-smoothie href="#example">...</a>
<!-- Somewhere below -->
<section id="example">
...
</section>
Call smoothie anywhere in your code:
// Call me
smoothie()
Configuring
To configure the plugin just pass the desired option(s) as an object like the example below:
// Pass options like this
smoothie({
behavior: 'auto'
})
Running Tasks
You can run tasks with the yarn
command like the example below:
# Build task
yarn build
# Lint task
yarn lint
Browser Support
You can check the browser support here.
If your desired browser is not in the list consider using this polyfill.
Contributing
Contributing is really easy, just make a pull request or open an issue and we will go from there.
License
Code released under the MIT license.