Custom Smooth Scroll Library – jetpack.js

Category: Animation , Javascript | October 8, 2018
Author: flynnham
Views Total: 1,581
Official Page: Go to website
Last Update: October 8, 2018
License: MIT

Preview:

Custom Smooth Scroll Library – jetpack.js

Description:

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.

You Might Be Interested In:


Leave a Reply