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:
freeAllow scrolling along both the horizontal and vertical axes.
horizontalAllow scrolling only along the horizontal axis.
verticalAllow scrolling only along the vertical axis.
dominantAllow scrolling along the horizontal or vertical axis, but not both at once. The direction of the initial drag will determine the scrolling axis.
horizontal-snapIn 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
snapElementsproperty. As the scroller scrolls from snap point to snap point it will send apropertyChangeevent.vertical-snapThis mode locks scrolling to the vertical axis, and snaps to points determined by the elements in the
snapElementsproperty 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access