dist/stickynav.es6.js
function scrollPage(to, offset, callback) {
  if ( offset === void 0 ) offset = 0;

  var startTime;
  var duration = 500;
  var startPos = window.pageYOffset;
  var endPos = ~~(to.getBoundingClientRect().top - offset);
  var scroll = function (timestamp) {
    var elapsed;

    startTime = startTime || timestamp;
    elapsed = timestamp - startTime;

    document.body.scrollTop = document.documentElement.scrollTop = easeInOutCubic(elapsed, startPos, endPos, duration);

    if (elapsed < duration) {
      requestAnimationFrame(scroll);
    } else if (callback) {
      callback.call(to);
    }
  };

  requestAnimationFrame(scroll);
}
function scrollPage(to, offset, callback) {
  if ( offset === void 0 ) offset = 0;

  var startTime;
  var duration = 500;
  var startPos = window.pageYOffset;
  var endPos = ~~(to.getBoundingClientRect().top - offset);
  var scroll = function (timestamp) {
    var elapsed;

    startTime = startTime || timestamp;
    elapsed = timestamp - startTime;

    document.body.scrollTop = document.documentElement.scrollTop = easeInOutCubic(elapsed, startPos, endPos, duration);

    if (elapsed < duration) {
      requestAnimationFrame(scroll);
    } else if (callback) {
      callback.call(to);
    }
  };

  requestAnimationFrame(scroll);
}
function scrollPage ( to , offset , callback ) { if ( offset === void 0 ) offset = 0 ; var startTime ; var duration = 500 ; var startPos = window . pageYOffset ; var endPos = ~ ~ ( to . getBoundingClientRect ( ) . top - offset ) ; var scroll = function ( timestamp ) { var elapsed ; startTime = startTime || timestamp ; elapsed = timestamp - startTime ; document . body . scrollTop = document . documentElement . scrollTop = easeInOutCubic ( elapsed , startPos , endPos , duration ) ; if ( elapsed < duration ) { requestAnimationFrame ( scroll ) ; } else if ( callback ) { callback . call ( to ) ; } } ; requestAnimationFrame ( scroll ) ; }
Scroll the page to a particular page anchor
@param {HTMLElement} to The element to scroll to.
@param {number} offset A scrolling offset.
@param {function} callback Function to apply after scrolling
@return {void}
Scroll the page to a particular page anchor