InfinityScroller
This class virtualizes a DOM Scroller to allow scroll ranges that exceed browser limits
and also allow negative scroll positions. These are managed by instances of InfinityAxis
named x and y.
Configs
6
Configs
6Set to null to disable smooth scroll animation.
The proportional amount of the browser's true scrollLimit to not use in order to reduce likelihood of browser anomalies. By default, 99% of the limit is used (this value being 1%, by default).
If not null, this config determines which axis to use for scroll snapping.
The minimum number of pixels or the minimum proportion of the item that must be scrolled to initiate a snap to reveal the whole item. A completed scroll of less than this amount is reversed. If this value is less-than 1, then this is the decimal fraction of the item's size. By default, this value is 0.1, which is 10% of the item's width. Otherwise, this value is an absolute number of pixels.
The InfinityAxis instance managing the x-axis.
The InfinityAxis instance managing the y-axis.
Properties
6
Properties
6Set to null to disable smooth scroll animation.
The proportional amount of the browser's true scrollLimit to not use in order to reduce likelihood of browser anomalies. By default, 99% of the limit is used (this value being 1%, by default).
If not null, this config determines which axis to use for scroll snapping.
The minimum number of pixels or the minimum proportion of the item that must be scrolled to initiate a snap to reveal the whole item. A completed scroll of less than this amount is reversed. If this value is less-than 1, then this is the decimal fraction of the item's size. By default, this value is 0.1, which is 10% of the item's width. Otherwise, this value is an absolute number of pixels.
The InfinityAxis instance managing the x-axis.
The InfinityAxis instance managing the y-axis.
Functions
1
Functions
1Scrolls to the specified x and y positions, or by the specified dx and dy. Only one of these values is
required. It is invalid to pass x and dx, or y and dy at the same time, however, it is valid to pass
x and dy, or y and dx.
This method returns a Promise that resolves to a boolean value. This value indicates that the desired scroll
adjustment was made. It is false if the scroll ends at a different position. This can happen if the user
interferes with the scroll, or another call to this method is made before the first call completes.
| Parameter | Type | Description |
|---|---|---|
options | Object | |
options.animate | Boolean | Specify |
options.dx | Number | The amount by which the |
options.dy | Number | The amount by which the |
options.x | Number | The new value for the |
options.y | Number | The new value for the |
Events
2
Events
2Fired when scrolling happens on this InfinityScroller's element.
// Adding a listener using the "on" method
infinityScroller.on('scroll', ({ relatedEvent, widget, source }) => {
});| Parameter | Type | Description |
|---|---|---|
relatedEvent | Event | The DOM event. |
widget | Container | The owning client instance. |
source | InfinityScroller | This InfinityScroller |
Fired when scrolling finished on this InfinityScroller's element.
// Adding a listener using the "on" method
infinityScroller.on('scrollEnd', ({ relatedEvent, widget, source }) => {
});| Parameter | Type | Description |
|---|---|---|
relatedEvent | Event | The last DOM event to fire. |
widget | Container | The owning client instance. |
source | InfinityScroller | This InfinityScroller |
Event handlers
2
Event handlers
2Called when scrolling happens on this InfinityScroller's element.
new InfinityScroller({
onScroll({ relatedEvent, widget, source }) {
}
});| Parameter | Type | Description |
|---|---|---|
relatedEvent | Event | The DOM event. |
widget | Container | The owning client instance. |
source | InfinityScroller | This InfinityScroller |
Called when scrolling finished on this InfinityScroller's element.
new InfinityScroller({
onScrollEnd({ relatedEvent, widget, source }) {
}
});| Parameter | Type | Description |
|---|---|---|
relatedEvent | Event | The last DOM event to fire. |
widget | Container | The owning client instance. |
source | InfinityScroller | This InfinityScroller |