Scrollers

The Scroller widget provides the scrolling behavior in Mojo. A scroller is installed automatically in every scene, and you can have any number of additional scrollers anywhere in the DOM.

Note

You can disable the scroller in a scene by setting the disableSceneScroller property to true in the scene arguments to pushScene.

In the current release of Mojo, you can select one of six scrolling modes, specified in the mode property of the widget’s attributes:

free

Allow scrolling along both the horizontal and vertical axes.

horizontal

Allow scrolling only along the horizontal axis.

vertical

Allow scrolling only along the vertical axis.

dominant

Allow scrolling along the horizontal or vertical axis, but not both at once. The direction of the initial drag will determine the scrolling axis.

horizontal-snap

In this mode, scrolling is locked to the horizontal axis, but snaps to points determined by the position of the block elements found in the model’s snapElements property. As the scroller scrolls from snap point to snap point it will send a propertyChange event.

vertical-snap

This mode locks scrolling to the vertical axis, and snaps to points determined by the elements in the snapElements property array.

Upon rendering, the widget targets its single child element for scrolling. If it has more than one child element, it will create a single div to wrap the child elements. It will never update this element, so if you replace the contents of a Scroller widget after it is instantiated, scrolling ...

Get Palm webOS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.