Unlike other jQuery projects, such as jQuery and jQuery UI, jQuery Mobile automatically applies many markup enhancements as soon as it loads (long before document.ready event fires). These enhancements are applied based on jQuery Mobile's default configuration, which is designed to work with common scenarios, but may or may not match your particular needs. Fortunately, these settings are easy to configure.
When the jQuery Mobile starts to execute, it triggers a mobileinit event on the document object, to which you can bind to apply overrides to jQuery Mobile's defaults.
$(document).bind("mobileinit", function(){
//apply overrides here
});
Because the mobileinit event is triggered immediately upon execution, you'll need to bind your event handler before jQuery Mobile is loaded. Thus, we recommend linking to your JavaScript files in the following order:
<script src="jquery.js"></script>
<script src="custom-scripting.js"></script>
<script src="jquery-mobile.js"></script>
Within this event binding, you can configure defaults either by extending the $.mobile object using jQuery's $.extend method:
$(document).bind("mobileinit", function(){
$.extend( $.mobile , {
foo: bar
});
});
...or by setting them individually:
$(document).bind("mobileinit", function(){
$.mobile.foo = bar;
});
The following defaults are configurable via the $.mobile object:
ns string, default: ""data-mynamespace-foo="...".
NOTE: if you're using data- namespacing, you'll need to manually update/override one selector in the theme CSS. The following data selectors should incorporate the namespace you're using:
.ui-mobile [data-mynamespace-role=page], .ui-mobile [data-mynamespace-role=dialog], .ui-page { ...
autoInitializePage boolean, default: true$.mobile.initializePage. If false, page will not initialize, and will be visually hidden until until $.mobile.initializePage is manually called.subPageUrlKey string, default: "ui-page"activePageClass string, default: "ui-page-active"activeBtnClass string, default: "ui-btn-active"ajaxEnabled boolean, default: truehashListeningEnabled boolean, default: truedefaultPageTransition string, default: 'slide'touchOverflowEnabled boolean, default: falseoverflow-scrolling: touch; property.defaultDialogTransition string, default: 'pop'minScrollBack string, default: 150loadingMessage string, default: "loading"pageLoadErrorMessage string, default: "Error Loading Page"gradeA function that returns a boolean, default: a function returning the value of $.support.mediaquery