Constructor
new Scroller(options)
Constructor.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | Overwrite the default options. |
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. |
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. |
Methods
to(options) → {module:base/utils/dom~Scroller}
Scroll to a target position.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | Overwrite the default to options. |
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. |
module:base/utils/dom~Scroller