Authors:Yoshiroh Kamiyama
Developers:Yoshiroh Kamiyama


SwapView is a container widget which can be swiped horizontally. SwapView is a subclass of dojox/mobile/View. SwapView allows the user to swipe the screen left or right to move between the views. When SwapView is swiped, it finds an adjacent SwapView to open. When the transition is done, a topic “/dojox/mobile/viewChanged” is published.

Note that, to behave properly, the SwapView needs to occupy the entire width of the screen.

Constructor Parameters

Inherited from dojox/mobile/View

Parameter Type Default Description
selected Boolean false If true, this view is displayed at startup time.


Basic usage is the same as for dojox/mobile/View. View transition will be performed in the order you place SwapViews in a page.


Declarative example

In this example, there are two SwapViews, and the user can swipe the screen to move the views back and forth.

<div data-dojo-type="dojox/mobile/SwapView">
  <h2 data-dojo-type="dojox/mobile/RoundRectCategory">Page flipping demo</h2>
  <div data-dojo-type="dojox/mobile/RoundRect">
    Swipe the screen left or right to flip between the views.

<div data-dojo-type="dojox/mobile/SwapView">
  <h1 data-dojo-type="dojox/mobile/Heading">View 2</h1>
  <div data-dojo-type="dojox/mobile/RoundRect">
    View 2
Error in the documentation? Can’t find what you are looking for? Let us know!