Chris
Chris

Reputation: 1428

jQuery Mobile navigate or changePage?

With the arrival of jQuery Mobile 1.3, the .navigate() function has been added. I've heard that is the recommended way to change pages, and it seems they addressed the issues of transferring data between pages.

The problem is, since it has been simplified, how do I access the other options that changePage offered? I would really like to use the {data} portion of the .navigate() but I would also like to set a few options that I do normally with changePage (such as transition, direction, etc).

I currently have a "router" that listens for all navigate events, then passes along any data that it receives on to the next page (doing some other simple logic as well, like setting up the views controller).

Is there some hidden properties in the [,options] that I would be able to set up simple things like direction and transition?

Upvotes: 7

Views: 12228

Answers (3)

PatoWhiz
PatoWhiz

Reputation: 1

Use the Pagecontainer widget added in v1.4.

$(":mobile-pagecontainer").pagecontainer("change", "jquerypageIdentifier",{ options in key value format } );

e.g

$(":mobile-pagecontainer").pagecontainer("change", "#nextpage",{ transition: "slide",role: "dialog" } );

Upvotes: 0

geoyws
geoyws

Reputation: 3687

The other way would be to use:

$.mobile.pageContainer.pagecontainer("change", "target", 
                 {transition: "flow", changeHash: false, reload: true})

Link

Upvotes: 0

Gajotres
Gajotres

Reputation: 57309

$.mobile.navigate is still a new function, according to code comments it is also a work in progress.

Transition is active among hidden options;

$.mobile.navigate( "#bar", { transition : "slide", info: "info about the #bar hash" });

Working example: http://jsfiddle.net/Gajotres/g5vAN/

On the other hand, change to direction reverse is still not implemented, default false value is applied.

Upvotes: 9

Related Questions