Configuring jQuery Mobile

When jQuery Mobile initializes, it triggers a mobileinit event on the document object. You can bind to the mobileinit event and apply overrides to jQuery Mobile’s ($.mobile) default configuration settings. In addition, you can extend jQuery Mobile with additional behavior and properties. For instance, there are two ways to configure jQuery Mobile as shown in the examples below. You can either override the properties via jQuery’s extend method or individually.

Examples:

// Configure properties via jQuery's extend method
$( document ).bind( "mobileinit", function(){
  $.extend( $.mobile, {
    // Override loading message
    loadingMessage: "Loading...",

    // Override default transition from “slide” to “pop”
    defaultTransition: "pop"
  });
});

// Configure properties individually
$( document ).bind( "mobileinit", function(){
  $.mobile.loadingMessage = "Initializing";
  $.mobile.defaultTransition = "slideup";
});

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *