
The jetpack.js JavaScript library allows the page to smoothly scroll between anchor links within the document.
With configurable duration, animation speed, and callback function.
How to use it:
Import the jetpack.js into the webpage.
<script src="/dist/jetpack.js"></script>
Initialize the jetpacek.js and we’re ready to go.
var jetpack = new jetPack(); jetpack.hookAnchors(); document.body.removeChild(document.body.lastChild);
To config the smooth scroll effect, just by passing the following options object to the ‘jetPack’ function.
{
// callback
callback: function(){},
// duration of animation
duration: 900,
// enabled automatic URL updating when page animation's are finished
updateURL: true},
// enable smooth scroll
animate:true
}Changelog:
10/08/2018
- Reformatted structure. Added support for exporting as module.







