Class

Scroller

base/utils/dom.Scroller(options)

Scroller class. Scroll to position or element using custom speeds and easings.

Constructor

new Scroller(options)

Constructor.
Parameters:
Name Type Description
options Object Overwrite the default options.

View Source utils/dom.js, line 276

Members

Object

static defaultOptions

Default scroller options.
Properties:
Name Type Default Description
rootElement Number [document.documentElement, document.body] - Target root element(s).
speed Number 1000 Scrolling speed (pixels per second).
easing Number 'easeOutSine' Easing equation.
offsetX Number 0 Offset that is taken away from target x position (e.g. for a fixed sidebar width).
offsetY Number 0 Offset that is taken away from target y position (e.g. for a fixed header height).
minScrollTime Number 0.1 Minimum scrolling time.
maxScrollTime Number 0.8 Maximum scrolling time.

View Source utils/dom.js, line 409

Object

static defaultToOptions

Default options for scrolling to methods. These will extend the default options.
Properties:
Name Type Default Description
x Number null Target position on x axis.
y Number null Target position on y axis.
cb function null Callback to execute when scrolling has finished.

View Source utils/dom.js, line 428

Methods

to(options) → {module:base/utils/dom~Scroller}

Scroll to a target position.
Parameters:
Name Type Description
options Object Overwrite the default to options.

View Source utils/dom.js, line 313

module:base/utils/dom~Scroller

toElement(element, options) → {module:base/utils/dom~Scroller}

Scroll to given element.
Parameters:
Name Type Description
element Element Target element.
options Object Overwrite the default to options.

View Source utils/dom.js, line 295

module:base/utils/dom~Scroller