Smooth Scroll Plugin

Features

$.fn.smoothScroll

Options

The following options, shown with their default values, are available for both $.fn.smoothScroll and $.smoothScroll:

{
  offset: 0,

  // one of 'top' or 'left'
  direction: 'top',

  // only use if you want to override default behavior
  scrollTarget: null,

  // fn(opts) function to be called before scrolling occurs.
  // `this` is the element(s) being scrolled
  beforeScroll: function() {},

  // fn(opts) function to be called after scrolling occurs.
  // `this` is the triggering element
  afterScroll: function() {},
  easing: 'swing',
  speed: 400,

  // coefficient for "auto" speed
  autoCoefficent: 2,

  // $.fn.smoothScroll only: whether to prevent the default click action
  preventDefault: true

}

The options object for $.fn.smoothScroll can take two additional properties: exclude and excludeWithin. The value for both of these is an array of selectors, DOM elements or jQuery objects. Default value for both is an empty array.

$.smoothScroll

Additional Option

The following option, in addition to those listed for $.fn.smoothScroll above, is available for $.smoothScroll:

{
  // jQuery set of elements you wish to scroll.
  //  if null (default), $('html, body').firstScrollable() is used.
  scrollElement: null,
}

$.fn.scrollable

$.fn.firstScrollable

Notes

© 2017