Changing Pages with jQuery Code

$("#pageTwo").on("swipeleft", function(){   $.mobile.changePage("newPage.html", {transition: "slide", reverse:true}); });

jQuery provides the $.mobile.changePage(URL, options) method to dynamically change pages, where URL is the new page location. Table 14.3 shows the available options for the .changePage() call. The following code is an example of adding a swipeleft event handler to load a remote web page when the user left-swipes the page on the device. Notice that a transition of “slide” is used, and reverse option is set to true:

$("#pageTwo").on("swipeleft", function(){   $.mobile.changePage("newPage.html", {transition: "slide", reverse:true}); ...

Get jQuery and JavaScript Phrasebook 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.