-
Notifications
You must be signed in to change notification settings - Fork 59
Usage: Scroller API
-
scrollTo(left, top, [duration]): Scroll to a given location, with optional duration. If a duration is passed, the scroll will use a smooth transition -
centerAt(left, top, [duration]): Center the scroller at a given location, with optional duration. -
scrollBy(left, top, [duration]): Scrolls by the given top and left values, with optional duration. -
scrollLeft/scrollTop: It is possible to set scrollLeft and scrollTop on the scroller instance as you would do on a regular DOM node.
TouchScroll instances also act as DOM Proxy. That means, you can use DOM methods and properties on a TouchScroll instance that map directly to the appropriate DOM node.
-
innerHTML: Gets/sets the innerHTML property of the innermost scrolling layer. -
innerText: Gets/sets the innerText property of the innermost scrolling layer. -
childNodes: References all child nodes of the innermost scrolling layer. -
children: References all child element nodes of the innermost scrolling layer. -
firstChild: References the last child node of the innermost scrolling layer. -
firstElementChild: References the last element child node of the innermost scrolling layer. -
lastChild: References the last child node of the innermost scrolling layer. -
lastElementChild: References the last element child node of the innermost scrolling layer. -
appendChild,insertBefore,replaceChild: All work on the innermost scrolling layer. -
querySelector,querySelectorAll: Work on the innermost scrolling layer.
-
setupScroller([force]): (Re-)Adapts the scroller to its dimensions if dimensions have changed or force is true. -
hideScrollbars(),showScrollbars(): Hides/Shows the scrollbars -
snapBack([axis]): Snaps the scroller back into its bounds. It should not be necessary to call this method manually.