The JQuery.mobile.changePage method is still a lot of. As a veteran, it is necessary to summarize the practical methods of jquery mobile. For a series of articles, see the jquery Mobile column. Jquery.mobile.changepage is an outdated jquery mobile 1.4.0 and will be removed in 1.5.0. Replace with the change () method of the Pagecontainer part.
Note that the method is used internally for page loading and conversion as a result, when you click on a link or submit a form. Jump External page All has no effect, must be internal div page to have effect.
JQuery.mobile.changePage (to [, Options])Parameter explanation Description:
to: A String type or object type that will jump to the destination page.
Options: Optional parameter, object type. The properties within its object are interpreted as follows:
allowsamepagetransition: Boolean type, default = False. By default, Changepage () ignores requests to change the current active page. Set to True to allow request execution. Note that some pages are converted to another page (Changepage requests the page and the page is different) and they may not be animated as expected.
Changehash: Boolean type, which defaults to true. When set to True, the hash update in the address bar creates the effect of a new browser history record. Set to False, the incoming page replaces the current page in browser history, and user navigation cannot go back to the previous page through the browser's Back button.
Data: Object type or string type, default is undefined. The jump page sends the parameters of the AJAX request.
Dataurl: String type, default is undefined. The URL address of the browser address to update when the page conversion is complete. If not specifically specified, the Data-url property value of the page element is used.
Pagecontainer: (jquery selector, default: $.mobile.pagecontainer) specifies the container that should contain the page.
Reloadpage: Boolean type, False by default. Forces a refresh of the page, even when the DOM element in the page container is ready. Only when the to parameter of Changepage () is an available address.
Reverse: Boolean type, False by default. Sets the direction of the page transition animation, which, when set to true, results in a transition in the opposite direction.
role: String type, default is undefined. Use the Data-role value when displaying the page. This parameter is recognized by default: Undefined, depending on the @data-role attribute of the element.
showloadmsg: Boolean type, Default true. Sets whether loading information is displayed when external pages are loaded.
transition: String type, default is $.mobile.defaultpagetransition. Rendered when transitioning to another page.
type: String type, default is get. Used only when the to parameter is specified.
Use the following example: Add Changehash: False to avoid problems caused by the IFRAME.
$.mobile.changepage (".. /resources/us.html ", {transition:" Slideup ", Changehash:false}); $.mobile.changepage (".. /resources/results.php ", {type:" POST ", Data: $ (" Form#search "). Serialize (), changehash:false}); $.mobile.changepage ( ".. /resources/confirm.html ", {transition:" Pop ", Reverse:false, Changehash:false});//Jump to" about Us "page with Slideup effect $.mobi Le.changepage ("about/us.html", "slideup"); The pop effect jumps to the "confirm" page and does not record its history $.mobile.changepage in the URL hash (".. /alerts/confirm.html "," Pop ", false, false); Jump to the "search results" page and submit the form data $.mobile.changepage with the "search" id ({URL: "searchresults.php", type: "Get", Data: $ ("form# Search "). Serialize ()}); The page URL, type, and data are defined as variables to be passed. $.mobile.changepage ({url:formresults.php, type: ' Get ', data:$ (' Form#myform '). Serialize ()});//use Changepage to load a third page $.mobile.changepage ([$.mobile.activepage.data (' Ui.prevpage '), Anotherpreviouspage], ' pop ');
JQuery.mobile.changePage method usage in JQuery mobile