You are browsing the archive for position.

Resetting dojox.mobile.ScrollableView to top

April 2, 2013 in Dojo, JavaScript, mobile, Web 2.0

ScrollableView is a container widget which represents an entire mobile device screen, and has a touch scrolling capability. Sometimes, you may need to reset ScrollableView to the top or to any position in the mobile screen.
In order to achieve this requirement, you need to use its scrollTo() API, for example, scrolling to top can be done by setting x and y to zero as follows:

require(["dojox/mobile/parser", "dijit/registry", ..., "dojo/domReady!"], function(parser, registry) {
	//...
	var view = registry.byId("someViewID");
	view.scrollTo({x:0 ,y: 0});
	//...
});

Following this approach, you can scroll ScrollableView to any position you like by specifying a suitable x and y values.

Skip to toolbar