Tizen 2.0 Release
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.2.0 / docs / api / globalconfig.html
1 <!DOCTYPE html>
2 <html>
3         <head>
4         <meta charset="utf-8">
5         <meta name="viewport" content="width=device-width, initial-scale=1">
6         <title>jQuery Mobile Docs - Configuring default settings</title>
7         <link rel="stylesheet"  href="../../css/themes/default/jquery.mobile.css" />
8         <link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
9
10         <script src="../../js/jquery.js"></script>
11         <script src="../../docs/_assets/js/jqm-docs.js"></script>
12         <script src="../../js/"></script>
13
14 </head>
15 <body>
16
17 <div data-role="page" class="type-interior">
18
19         <div data-role="header" data-theme="f">
20                 <h1>Configuring Defaults</h1>
21                 <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a>
22                 <a href="../nav.html" data-icon="search" data-iconpos="notext" data-rel="dialog" data-transition="fade">Search</a>
23         </div><!-- /header -->
24
25         <div data-role="content" data-theme="c">
26                 <div class="content-primary">
27
28                         <h2>Working with jQuery Mobile's Auto-initialization</h2>
29                         <p>Unlike other jQuery projects, such as jQuery and jQuery UI, jQuery Mobile automatically applies many markup enhancements as soon as it loads (long before the <code>document.ready</code> event fires). These enhancements are applied based on jQuery Mobile's default settings, which are designed to work with common scenarios. If changes to the settings are needed, they are easy to configure.</p>
30
31                         <h3>The mobileinit event</h3>
32                         <p>When jQuery Mobile starts, it triggers a <code>mobileinit</code> event on the <code>document</code> object. To override default settings, bind to <code>mobileinit</code>.</p>
33
34                         <pre>
35                                 <code>
36 $(document).bind("mobileinit", function(){
37   //apply overrides here
38 });
39                                 </code>
40                         </pre>
41
42                         <p>Because the <code>mobileinit</code> event is triggered immediately, you'll need to bind your event handler before jQuery Mobile is loaded. Link to your JavaScript files in the following order:</p>
43
44                         <pre>
45                                 <code>
46 &lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
47 <strong>&lt;script src=&quot;custom-scripting.js&quot;&gt;&lt;/script&gt;</strong>
48 &lt;script src=&quot;jquery-mobile.js&quot;&gt;&lt;/script&gt;
49                                 </code>
50                         </pre>
51
52                         <p>You can override default settings by extending the <code>$.mobile</code> object using jQuery's <code>$.extend</code> method.</p>
53
54                         <pre>
55                                 <code>
56 $(document).bind("mobileinit", function(){
57   $.extend(  $.mobile , {
58     <strong>foo: bar</strong>
59   });
60 });
61                                 </code>
62                         </pre>
63
64                         <p>Alternatively, you can set them using object property notation.</p>
65                         <pre>
66                                 <code>
67 $(document).bind("mobileinit", function(){
68   <strong>$.mobile.foo = bar;</strong>
69 });
70                                 </code>
71                         </pre>
72
73                 <p>To explore the effects of global configuration options, see the <a href="../config/index.html">config test pages</a>.</p>
74
75                 <h2>Configurable options</h2>
76                 <p>The following defaults are configurable via the <code>$.mobile</code> object:</p>
77
78 <dl>
79         <dt><code>activeBtnClass</code> <em>string</em>, default: "ui-btn-active"</dt>
80         <dd>The CSS class used for "active" button state.</dd>
81
82         <dt><code>activePageClass</code> <em>string</em>, default: "ui-page-active"</dt>
83         <dd>The CSS class used for the page currently in view or in a transition.</dd>
84
85         <dt><code>ajaxEnabled</code> <em>boolean</em>, default: true</dt>
86         <dd>jQuery Mobile will automatically handle link clicks and form submissions through Ajax, when possible. If false, URL hash listening will be disabled as well, and URLs will load as ordinary HTTP requests.</dd>
87
88         <dt><code>allowCrossDomainPages</code> <em>boolean</em>, default: false</dt>
89         <dd>When jQuery Mobile attempts to load an external page, the request runs through <code>$.mobile.loadPage()</code>. This will only allow cross-domain requests if <code>$.mobile.allowCrossDomainPages</code> is set to true. Because the jQuery Mobile framework tracks what page is being viewed within the browser's location hash, it is possible for a cross-site scripting (XSS) attack to occur if the XSS code in question can manipulate the hash and set it to a cross-domain URL of its choice. This is the main reason that the default setting for $.mobile.allowCrossDomainPages is set to false. In PhoneGap apps that must "phone home" by loading assets off a remote server, both the <code>$.support.cors</code> AND <code>$.mobile.allowCrossDomainPages</code> must be set to true.</dd>
90
91         <dt><code>autoInitializePage</code> <em>boolean</em>, default: true</dt>
92         <dd>When the DOM is ready, the framework should automatically call <code>$.mobile.initializePage</code>. If false, the page will not initialize and will be visually hidden until <code>$.mobile.initializePage</code> is manually called.</dd>
93
94         <dt><code>buttonMarkup.hoverDelay</code> <em>integer</em>, default: 200</dt>
95         <dd>Set the delay for touch devices to add the hover and down classes on touch interactions for buttons throughout the framework. Reducing the delay here results in a more responsive feeling ui, but will often result in the downstate being applied during page scrolling.</dd>
96
97         <dt><code>defaultDialogTransition</code> <em>string</em>, default: 'pop'</dt>
98         <dd>Set the default transition for dialog changes that use Ajax. Set to 'none' for no transitions.</dd>
99
100         <dt><code>defaultPageTransition</code> <em>string</em>, default: 'fade'</dt>
101         <dd>Set the default transition for page changes that use Ajax. Note: default changed from 'slide' to 'fade' in 1.1. Set to 'none' for no transitions.</dd>
102
103         <dt><code>getMaxScrollForTransition</code> <em>integer</em>, default: 3</dt>
104         <dd>Set a scroll position breakpoint for transitions. If the scroll position is greater than the window height multiplied by the value that has been set, transition "none" will be used.</dd>
105     
106         <dt><code>gradeA</code> <em>function that returns a boolean</em>, default: a function returning the value of $.support.mediaquery</dt>
107         <dd>Any support conditions that must be met in order to proceed.</dd>
108
109         <dt><code>hashListeningEnabled</code> <em>boolean</em>, default: true</dt>
110         <dd>jQuery Mobile will automatically listen and handle changes to the location.hash. Disabling this will prevent jQuery Mobile from handling hash changes, which allows you to handle them yourself or use simple deep-links within a document that scroll to a particular id.</dd>
111
112         <dt><code>ignoreContentEnabled</code> <em>boolean</em>, default: false</dt>
113         <dd><em>Warning:</em> Setting this property to true will cause performance degradation on enhancement. Once set, all automatic enhancements made by the framework to each enhanceable element of the user's markup will first check for a <code>data-enhance=false</code> parent node. If one is found the markup will be ignored. This setting and the accompanying data attribute provide a mechanism through which users can prevent enhancement over large sections of markup.</dd>
114
115         <dt><code>linkBindingEnabled</code> <em>boolean</em>, default: true</dt>
116         <dd>jQuery Mobile will automatically bind the clicks on anchor tags in your document. Setting this option to false will prevent all anchor click handling <em>including</em> the addition of active button state and alternate link bluring. This should only be used when attempting to delegate the click management to another library or custom code.</dd>
117
118         <dt><code>loadingMessage</code> <em>string</em>, default: "loading"</dt>
119         <dd>
120     Set the text that appears when a page is loading. If set to false, the message will not appear at all.
121     <p class="ui-body ui-body-e"><strong>Deprecated</strong> in 1.2 - use <code>$.mobile.loader.prototype.options.text</code> instead. See the <a href="../../docs/pages/loader.html">loader docs</a> for more.</p>
122   </dd>
123
124         <dt><code>loadingMessageTextVisible</code> <em>boolean</em>, default: false</dt>
125         <dd>
126     Whether the text should be visible when a loading message is shown. The text is always visible for loading errors.
127     <p class="ui-body ui-body-e"><strong>Deprecated</strong> in 1.2 - use <code>$.mobile.loader.prototype.options.textVisible</code> instead. See the <a href="../../docs/pages/loader.html">loader docs</a> for more.</p>
128   </dd>
129
130         <dt><code>loadingMessageTheme</code> <em>string</em>, default: "a"</dt>
131         <dd>
132     The theme that the loading message box uses when text is visible.
133     <p class="ui-body ui-body-e"><strong>Deprecated</strong> in 1.2 - use <code>$.mobile.loader.prototype.options.theme</code> instead. See the <a href="../../docs/pages/loader.html">loader docs</a> for more.</p>
134         </dd>
135
136         <dt><code>maxTransitionWidth</code> <em>integer, boolean</em>, default: false</dt>
137         <dd>Set a max width for transitions. The option accepts any number representing a pixel width and its default value <code>false</code>. If a number value is set, transition "none" will be used if the window is wider than the specified value.</dd>
138     
139         <dt><code>minScrollBack</code> <em>integer</em>, default: 250</dt>
140         <dd>Minimum scroll distance that will be remembered when returning to a page.</dd>
141
142         <dt><code>ns</code> <em>string</em>, default: ""</dt>
143         <dd>The namespace used in data attributes (e.g., data-role). Can be set to any string, including a blank string which is the default. When using, it's clearest if you include a trailing dash, such as "mynamespace-" which maps to <code>data-mynamespace-foo="..."</code>.
144                 <p>If you use data- namespacing, you will need to update/override one selector in the theme CSS. The following data selectors should incorporate the namespace you're using:
145                 <pre><code>
146 .ui-mobile [data-<strong>mynamespace-</strong>role=page], .ui-mobile [data-<strong>mynamespace-</strong>role=dialog], .ui-page { ...
147                 </code></pre>
148                 </p>
149         </dd>
150
151         <dt><code>pageLoadErrorMessage</code> <em>string</em>, default: "Error Loading Page"</dt>
152         <dd>Set the text that appears when a page fails to load through Ajax.</dd>
153
154         <dt><code>pageLoadErrorMessageTheme</code> <em>string</em>, default: "e"</dt>
155         <dd>Set the theme that the error message box uses.</dd>
156
157         <dt><code>phonegapNavigationEnabled</code> <em>boolean</em>, default: false</dt>
158         <dd>Replace calls to <code>window.history.back</code> with PhoneGap's navigation helper where it is available. This addresses navigation issues on page refresh in Android PhoneGap applications using jQuery Mobile.</dd>
159
160         <dt><code>pushStateEnabled</code> <em>boolean</em>, default: true</dt>
161         <dd>Enhancement to use <code>history.replaceState</code> in supported browsers, to convert the hash-based Ajax URL into the full document path. Note that we <a href="../pages/page-navmodel.html">recommend</a> disabling this feature if Ajax is disabled or if external links are used extensively.</dd>
162
163         <dt><code>subPageUrlKey</code> <em>string</em>, default: "ui-page"</dt>
164         <dd>The url parameter used for referencing widget-generated sub-pages (such as those generated by nested listviews). Translates to <em>example.html<strong>&ui-page=</strong>subpageIdentifier</em>. The hash segment before &ui-page= is used by the framework for making an Ajax request to the URL where the sub-page exists.</dd>
165
166         <dt><code>touchOverflowEnabled</code> <em>boolean</em>, default: false</dt>
167         <dd>
168         Enable smoother page transitions and true fixed toolbars in devices that support both the <code>overflow:</code> and <code>overflow-scrolling: touch; </code> CSS properties.
169         <p class="ui-body ui-body-e"><strong>Deprecated</strong> in 1.1.0</p>
170         </dd>
171     
172         <dt><code>transitionFallbacks.[transition]</code> <em>string</em>, default: "fade"</dt>
173         <dd>Set the fallback transition for browsers that don't support 3D transforms for a specific transition type.</dd>
174
175 </dl>
176         </div><!--/content-secondary -->
177
178         <div class="content-secondary">
179
180                 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
181
182                                 <h3>More in this section</h3>
183
184                                 <ul data-role="listview"  data-theme="c" data-dividertheme="d">
185
186                                         <li data-role="list-divider">API</li>
187                                         <li data-theme="a"><a href="../../docs/api/globalconfig.html">Configuring defaults</a></li>
188                                         <li><a href="../../docs/api/events.html">Events</a></li>
189                                         <li><a href="../../docs/api/methods.html">Methods &amp; Utilities</a></li>
190                                         <li><a href="../../docs/api/data-attributes.html">Data attribute reference</a></li>
191                                         <li><a href="../../docs/api/themes.html">Theme framework</a></li>
192                                 </ul>
193                 </div>
194         </div>
195
196 </div><!-- /content -->
197
198 <div data-role="footer" class="footer-docs" data-theme="c">
199                 <p class="jqm-version"></p>
200                 <p>&copy; 2012 jQuery Foundation and other contributors</p>
201 </div>
202
203 </div><!-- /page -->
204
205 </body>
206 </html>