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.


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:


Allow scrolling along both the horizontal and vertical axes.


Allow scrolling only along the horizontal axis.


Allow scrolling only along the vertical axis.


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


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.


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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.