Vanilla JS Smooth Scroll
Easy to use!
Usage:
    
  let links = document.getElementsByTagName('a');

  [].forEach.call(links, (el) => {
    el.scrollToSmooth({
      speed: 500,
      easing: 'easeInOutQuint',
      callback: function () { console.log('we reached it!'); },
      fixedHeader: null
    });
  });
    
    

Options:

speed
Type: Number
Default: 400

Scroll time in milliseconds

easing
Type: string
Default: linear

Easing function used for scrolling.
Available Easings:

  • linear
  • easeInQuad
  • easeOutQuad
  • easeInOutQuad
  • easeInCubic
  • easeOutCubic
  • easeInOutCubic
  • easeInQuart
  • easeOutQuart
  • easeInOutQuart
  • easeInQuint
  • easeOutQuint
  • easeInOutQuint
  • easeInElastic
  • easeOutElastic
  • easeInOutElastic

callback
Type: function
Default: null

Callback to be executed when scrolling is finished

fixedHeader
Type: string
Default: null

The header element
Example: '#fixed-header'

Here we go!