summaryrefslogtreecommitdiff
path: root/libs/js/jquery-mobile-1.0.1pre/docs/api/data-attributes.html
blob: 67b441d7ed89f270a298fcccc2356a84d2844261 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
<!DOCTYPE html> 
<html> 
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<title>jQuery Mobile Docs - Data Attribute Reference</title> 
	<link rel="stylesheet"  href="../../css/themes/default/" /> 
	<link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
	<script src="../../js/jquery.js"></script>
	<script src="../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
	<script src="../_assets/js/jqm-docs.js"></script>
	<script src="../../js/"></script>
</head> 
<body> 

<div data-role="page" class="type-interior">

	<div data-role="header" data-theme="f">
		<h1>Data Attributes</h1>
		<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
	</div><!-- /header -->

	<div data-role="content" data-theme="c">

		<div class="content-primary">
			<h2>Data- attribute reference</h2>
			<p>The jQuery Mobile framework uses HTML5 <code>data-</code> attributes to allow for markup-based initialization and configuration of widgets. These attributes are completely optional; calling plugins manually and passing options directly is also supported. To avoid naming conflicts with other plugins or frameworks that also use <code>data-</code> attributes, set a custom namespace by modifying the <a href="globalconfig.html"><code>ns</code> global option</a>.<p>

				<style>
					table { width:100%; border-bottom:1px solid #ccc; }
					th { text-align:left; width: 170px; }
					th, td { vertical-align:top; border-top:1px solid #ccc; padding: 6px 10px 4px 0; }
				</style>

			<h2><a href="../buttons/buttons-types.html">Button</a></h2>
			<p>Links with <code>data-role="button"</code>. Input-based buttons and button elements are auto-enhanced, no <code>data-role</code> required</p>
			<table>
				<tr>
					<th>data-corners</th>
					<td><strong>true</strong> | false</td>
				</tr>
				<tr>
					<th>data-icon</th>
					<td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
				</tr>
				<tr>
					<th>data-iconpos</th>
					<td><strong>left</strong> | right | top | bottom |  notext</td>
				</tr>
				<tr>
					<th>data-iconshadow</th>
					<td><strong>true</strong> | false</td>
				</tr>
				<tr>
					<th>data-inline</th>
					<td>true | <strong>false</strong></td>
				</tr>
				<tr>
					<th>data-shadow</th>
					<td><strong>true</strong> | false</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
			</table>
			<p>Multiple buttons can be wrapped in a container with a <code>data-role="controlgroup"</code> attribute for a vertically grouped set. Add the <code>data-type="horizontal"</code> attribute for the buttons to sit side-by-side.</p>


			<h2><a href="../forms/checkboxes/">Checkbox</a></h2>
			<p>Pairs of labels and inputs with <code>type="checkbox"</code> are auto-enhanced, no <code>data-role</code> required</p>
			<table>
				<tr>
					<th>data-role</th>
					<td>none (prevents auto-enhancement to use native control)</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z) - Added to the form element</td>
				</tr>
			</table>

			<h2><a href="../content/content-collapsible.html">Collapsible</a></h2>
			<p>A heading and content wrapped in a container with the <code>data-role="collapsible"</code></p>
			<table>
				<tr>
					<th>data-collapsed</th>
					<td><strong>true</strong> | false</td>
				</tr>
				<tr>
					<th>data-content-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
			</table>

			<h2><a href="../content/content-collapsible-set.html">Collapsible set</a></h2>
			<p>A number of collapsibles wrapped in a container with the <code>data-role="collapsible-set"</code></p>
			<table>
				<tr>
					<th>data-content-theme</th>
					<td>swatch letter (a-z) - Sets all collapsibles in set</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z) - Sets all collapsibles in set</td>
				</tr>
			</table>
			
			<h2><a href="../pages/page-dialogs.html">Dialog</a></h2>
			<p>Container with <code>data-role="page"</code> or <code>"dialog"</code> linked to with <code>data-rel="dialog"</code> on the anchor.</p>
			<table>
				<tr>
					<th>data-close-btn-text</th>
					<td>string (text for the close button, dialog only)</td>
				</tr>
				<tr>
					<th>data-dom-cache</th>
					<td>true | <strong>false</strong></td>
				</tr>
				<tr>
					<th>data-id</th>
					<td>string (unique id for the page)</td>
				</tr>
				<tr>
					<th>data-fullscreen</th>
					<td>true | false (used in conjunction with fixed toolbars)</td>
				</tr>
				<tr>
					<th>data-overlay-theme</th>
					<td>swatch letter (a-z) - overlay theme when the page is opened in a dialog</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
				<tr>
					<th>data-title</th>
					<td>string (title used when page is shown)</td>
				</tr>
			</table>

			<h2><a href="../pages/page-anatomy.html">Content</a></h2>
			<p>Container with <code>data-role="content"</code></p>
			<table>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
			</table>


			<h2><a href="../forms/docs-forms.html">Field container</a></h2>
			<p>Container with <code>data-role="fieldcontain"</code> wrapped around label/form element pair</p>

			<h2><a href="../forms/switch/">Flip toggle switch</a></h2>
			<p>Select with <code>data-role="slider"</code>, two options only</p>
			<table>
				<tr>
					<th>data-role</th>
					<td>none (prevents auto-enhancement to use native control)</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z) - Added to the form element</td>
				</tr>
				<tr>
					<th>data-track-theme</th>
					<td>swatch letter (a-z) - Added to the form element</td>
				</tr>
			</table>

			<h2><a href="../toolbars/docs-footers.html">Footer</a></h2>
			<p>Container with <code>data-role="footer"</code></p>
			<table>
				<tr>
					<th>data-id</th>
					<td>string (unique id, useful in persistent footers)</td>
				</tr>
				<tr>
					<th>data-position</th>
					<td>fixed</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
			</table>

			<h2><a href="../toolbars/docs-headers.html">Header</a></h2>
			<p>Container with <code>data-role="header"</code></p>
			<table>
				<tr>
					<th>data-add-back-btn</th>
					<td>true | <strong>false</strong> (auto add back button, header only)</td>
				</tr>
				<tr>
					<th>data-back-btn-text</th>
					<td>string</td>
				</tr>
				<tr>
					<th>data-back-btn-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
				<tr>
					<th>data-position</th>
					<td>fixed</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
				<tr>
					<th>data-title</th>
					<td>string (title used when page is shown)</td>
				</tr>
			</table>

			<h2><a href="../pages/page-links.html">Link</a></h2>
			<p>Links, including those with a <code>data-role="button"</code>, and form submit buttons share these attributes</p>
			<table>
				<tr>
					<th>data-ajax</th>
					<td><strong>true</strong> | false</td>
				</tr>
				<tr>
					<th>data-direction</th>
					<td>reverse (reverse page transition animation)</td>
				</tr>
				<tr>
					<th>data-dom-cache</th>
					<td>true | <strong>false</strong></td>
				</tr>
				<tr>
					<th>data-prefetch</th>
					<td>true | <strong>false</strong></td>
				</tr>
				<tr>
					<th>data-rel</th>
					<td>back (to move one step back in history)<br />
						dialog (to open link styled as dialog, not tracked in history)<br />
						external (for linking to another domain)</td>
				</tr>
				<tr>
					<th>data-transition</th>
					<td><strong>slide</strong> | slideup | slidedown | pop | fade | flip</td>
				</tr>
			</table>

			<h2><a href="../lists/docs-lists.html">Listview</a></h2>
			<p>OL or UL with <code>data-role="listview"</code></p>
			<table>
				<tr>
					<th>data-count-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
				<tr>
					<th>data-dividertheme</th>
					<td>swatch letter (a-z)</td>
				</tr>
				<tr>
					<th>data-filter</th>
					<td>true | <strong>false</strong></td>
				</tr>
				<tr>
					<th>data-filter-placeholder</th>
					<td>string</td>
				</tr>
				<tr>
					<th>data-filter-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
				<tr>
					<th>data-inset</th>
					<td>true | <strong>false</strong></td>
				</tr>
				<tr>
					<th>data-split-icon</th>
					<td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
			</table>

			<h2><a href="../lists/docs-lists.html">Listview item</a></h2>
			<p>LI within a listview</p>
			<table>
				<tr>
					<th>data-icon</th>
					<td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
				</tr>
				<tr>
					<th>data-role</th>
					<td>list-divider</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z) - can also be set on individual LIs</td>
				</tr>
			</table>

			<h2><a href="../pages/page-anatomy.html">Page</a></h2>
			<p>Container with <code>data-role="page"</code></p>
			<table>
				<tr>
					<th>data-close-btn-text</th>
					<td>string (text for the close button, dialog only)</td>
				</tr>
				<tr>
					<th>data-dom-cache</th>
					<td>true | <strong>false</strong></td>
				</tr>
				<tr>
					<th>data-id</th>
					<td>string (unique id for the page)</td>
				</tr>
				<tr>
					<th>data-fullscreen</th>
					<td>true | false (used in conjunction with fixed toolbars)</td>
				</tr>
				<tr>
					<th>data-overlay-theme</th>
					<td>swatch letter (a-z) - overlay theme when the page is opened in a dialog</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z)</td>
				</tr>
				<tr>
					<th>data-title</th>
					<td>string (title used when page is shown)</td>
				</tr>
			</table>

			<h2><a href="../forms/radiobuttons/">Radio button</a></h2>
			<p>Pairs of labels and inputs with <code>type="radio"</code> are auto-enhanced, no <code>data-role</code> required</p>
			<table>
				<tr>
					<th>data-role</th>
					<td>none (prevents auto-enhancement to use native control)</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z) - Added to the form element</td>
				</tr>
			</table>

			<h2><a href="../forms/selects/">Select</a></h2>
			<p>All <code>select</code> form elements are auto-enhanced, no <code>data-role</code> required</p>
			<table>
				<tr>
					<th>data-icon</th>
					<td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
				</tr>
				<tr>
					<th>data-iconpos</th>
					<td><strong>left</strong> | right | top | bottom |  notext</td>
				</tr>
				<tr>
					<th>data-inline</th>
					<td>true | <strong>false</strong></td>
				</tr>
				<tr>
					<th>data-native-menu</th>
					<td><strong>true</strong> | false</td>
				</tr>
				<tr>
					<th>data-overlay-theme</th>
					<td>swatch letter (a-z) - overlay theme for non-native selects</td>
				</tr>
				<tr>
					<th>data-placeholder</th>
					<td>true | false - Add to the Option</td>
				</tr>
				<tr>
					<th>data-role</th>
					<td>none (prevents auto-enhancement to use native control)</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z) - Added to the form element</td>
				</tr>	
			</table>
			<p>Multiple selects can be wrapped in a fieldset with a <code>data-role="controlgroup"</code> attribute for a vertically grouped set. Add the <code>data-type="horizontal"</code> attribute for the selects to sit side-by-side.</p>

			<h2><a href="../forms/slider/">Slider</a></h2>
			<p>Inputs with <code>type="range"</code> are auto-enhanced, no <code>data-role</code> required</p>
			<table>
				<tr>
					<th>data-role</th>
					<td>none (prevents auto-enhancement to use native control)</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z) - Added to the form element</td>
				</tr>
				<tr>
					<th>data-track-theme</th>
					<td>swatch letter (a-z) - Added to the form element</td>
				</tr>
			</table>

			<h2><a href="../forms/textinputs/">Text input &amp; Textarea</a></h2>
			<p>Input <code>type="text|number|search|etc."</code> or <code>textarea</code> elements are auto-enhanced, no <code>data-role</code> required</p>
			<table>
				<tr>
					<th>data-role</th>
					<td>none (prevents auto-enhancement to use native control)</td>
				</tr>
				<tr>
					<th>data-theme</th>
					<td>swatch letter (a-z) - Added to the form element</td>
				</tr>
			</table>

		</div><!--/content -->		

	<div class="content-secondary">

		<div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">

				<h3>More in this section</h3>

				<ul data-role="listview"  data-theme="c" data-dividertheme="d">

					<li data-role="list-divider">API</li>
					<li><a href="../../docs/api/globalconfig.html">Configuring defaults</a></li>
					<li><a href="../../docs/api/events.html">Events</a></li>
					<li><a href="../../docs/api/methods.html">Methods &amp; Utilities</a></li>
					<li data-theme="a"><a href="../../docs/api/data-attributes.html">Data attribute reference</a></li>
					<li><a href="../../docs/api/themes.html">Theme framework</a></li>
				</ul>
		</div>
	</div>		

</div><!-- /content -->

<div data-role="footer" class="footer-docs" data-theme="c">
		<p>&copy; 2011 The jQuery Project</p>
</div>

</div><!-- /page -->

</body>
</html>