Skip to content

Commit 7a73533

Browse files
committed
Added documentation on collapsible set plugin API
1 parent c754dec commit 7a73533

File tree

5 files changed

+306
-7
lines changed

5 files changed

+306
-7
lines changed

docs/content/content-collapsible-options.html

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ <h2>Collapsible content</h2>
3838
<dl>
3939
<dt><code>collapsed</code> <em>boolean</em></dt>
4040
<dd>
41-
<p class="default">default: false</p>
42-
<p>When true, the container is initially collapsed with a plus icon. To set the value for all instances of this widget, bind this option to the <a href="../../api/globalconfig.html">mobileinit event</a>:</p>
41+
<p class="default">default: true</p>
42+
<p>When false, the container is initially expanded with a minus icon in the header. To set the value for all instances of this widget, bind this option to the <a href="../../api/globalconfig.html">mobileinit event</a>:</p>
4343
<pre><code>$( document ).bind( "mobileinit", function(){
44-
<strong>$.mobile.collapsible.prototype.options.collapsed = true;</strong>
44+
<strong>$.mobile.collapsible.prototype.options.collapsed = false;</strong>
4545
});
4646
</code></pre>
47-
<p>This option is also exposed as a data attribute: <code>data-collapsed=&quot;true&quot;</code>.</p>
47+
<p>This option is also exposed as a data attribute: <code>data-collapsed=&quot;false&quot;</code>.</p>
4848
</dd>
4949

5050
<dt><code>collapseCueText</code> <em>string</em></dt>
@@ -88,6 +88,17 @@ <h2>Collapsible content</h2>
8888
</code></pre>
8989
</dd>
9090

91+
<dt><code>iconpos</code> <em>string</em></dt>
92+
<dd>
93+
<p class="default">default: "left"</p>
94+
<p>Positions the icon in the collapsible header. Possible values: left, right, top, bottom, none, notext.</p>
95+
<pre><code>$( document ).bind( "mobileinit", function(){
96+
<strong>$.mobile.collapsible.prototype.options.iconpos = "right";</strong>
97+
});
98+
</code></pre>
99+
<p>This option is also exposed as a data attribute: <code>data-iconpos=&quot;right&quot;</code>.</p>
100+
</dd>
101+
91102
<!--
92103
<dt><code>iconTheme</code> <em>string</em></dt>
93104
<dd>
@@ -114,7 +125,7 @@ <h2>Collapsible content</h2>
114125
<dt><code>mini</code> <em>boolean</em></dt>
115126
<dd>
116127
<p class="default">default: false</p>
117-
<p>Sets the size of the element to a more compact, <a href="../forms/forms-all-mini.html">mini version</a>. To set the value for all instances of this widget, bind this option to the <a href="../../api/globalconfig.html">mobileinit event</a>:</p>
128+
<p>Sets the size of the element to a more compact, <a href="../forms/forms-all-mini.html">mini version</a>. If the value is false for an individual collapsible container, but that container is part of a collapsible set, then the value is inherited from the parent collapsible set. To set the value for all instances of this widget, bind this option to the <a href="../../api/globalconfig.html">mobileinit event</a>:</p>
118129
<pre><code>$( document ).bind( "mobileinit", function(){
119130
<strong>$.mobile.collapsible.prototype.options.mini = true;</strong>
120131
});
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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 - Collapsible Content</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>Collapsible sets (accordions)</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">
26+
<div class="content-primary">
27+
<h2>Collapsible sets</h2>
28+
29+
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
30+
<li><a href="content-collapsible-set.html" data-role="button" data-transition="fade">Basics</a></li>
31+
<li><a href="content-collapsible-set-options.html" data-role="button" data-transition="fade">Options</a></li>
32+
<li><a href="content-collapsible-set-methods.html" data-role="button" data-transition="fade">Methods</a></li>
33+
<li><a href="content-collapsible-set-events.html" data-role="button" data-transition="fade" class="ui-btn-active">Events</a></li>
34+
</ul>
35+
36+
<p>Bind events directly to the set container, typically a <code>div</code> element. Use jQuery Mobile's <a href="../api/events.html">virtual events</a>, or bind standard JavaScript events, like change, focus, blur, etc.:</p>
37+
<pre><code>
38+
$( ".selector" ).bind( "create", function(event, ui) {
39+
...
40+
});
41+
</code></pre>
42+
43+
<p>The collapsible set plugin has the following custom event:</p>
44+
45+
<dl>
46+
47+
<dt><code>create</code> triggered when a collapsible set is created</dt>
48+
<dd>
49+
50+
<pre><code>
51+
$( ".selector" ).collapsibleset({
52+
create: function(event, ui) { ... }
53+
});
54+
</code></pre>
55+
</dd>
56+
57+
</dl>
58+
59+
</div><!--/content-primary -->
60+
61+
<div class="content-secondary">
62+
63+
<div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
64+
65+
<h3>More in this section</h3>
66+
67+
<ul data-role="listview" data-theme="c" data-dividertheme="d">
68+
69+
<li data-role="list-divider">Content Formatting</li>
70+
<li><a href="content-html.html">Basic HTML styles</a></li>
71+
<li><a href="content-grids.html">Layout grids (columns)</a></li>
72+
<li><a href="content-collapsible.html">Collapsible content blocks</a></li>
73+
<li data-theme="a"><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
74+
<li><a href="content-themes.html">Theming content</a></li>
75+
76+
</ul>
77+
</div>
78+
</div>
79+
80+
</div><!-- /content -->
81+
82+
<div data-role="footer" class="footer-docs" data-theme="c">
83+
<p>&copy; 2011-12 The jQuery Project</p>
84+
</div>
85+
86+
</div><!-- /page -->
87+
88+
</body>
89+
</html>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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 - Collapsible Sets</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>Collapsible sets (accordions)</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">
26+
<div class="content-primary">
27+
<h2>Collapsible sets</h2>
28+
29+
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
30+
<li><a href="content-collapsible-set.html" data-role="button" data-transition="fade">Basics</a></li>
31+
<li><a href="content-collapsible-set-options.html" data-role="button" data-transition="fade">Options</a></li>
32+
<li><a href="content-collapsible-set-methods.html" data-role="button" data-transition="fade" class="ui-btn-active">Methods</a></li>
33+
<li><a href="content-collapsible-set-events.html" data-role="button" data-transition="fade">Events</a></li>
34+
</ul>
35+
36+
<p>The collapsible set plugin has the following method:</p>
37+
38+
<dl>
39+
<dt><code>refresh</code> update the collapsible set</dt>
40+
<dd>
41+
<p>If you manipulate a collapsible set via JavaScript (e.g. add new collapsible containers), you must call the refresh method on it to update the visual styling.</p>
42+
43+
<pre><code>
44+
$('.selector').collapsibleset('refresh');
45+
</code></pre>
46+
</dd>
47+
48+
</dl>
49+
50+
</div><!--/content-primary -->
51+
52+
<div class="content-secondary">
53+
54+
<div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
55+
56+
<h3>More in this section</h3>
57+
58+
<ul data-role="listview" data-theme="c" data-dividertheme="d">
59+
60+
<li data-role="list-divider">Content Formatting</li>
61+
<li><a href="content-html.html">Basic HTML styles</a></li>
62+
<li><a href="content-grids.html">Layout grids (columns)</a></li>
63+
<li><a href="content-collapsible.html">Collapsible content blocks</a></li>
64+
<li data-theme="a"><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
65+
<li><a href="content-themes.html">Theming content</a></li>
66+
67+
</ul>
68+
</div>
69+
</div>
70+
71+
</div><!-- /content -->
72+
73+
<div data-role="footer" class="footer-docs" data-theme="c">
74+
<p>&copy; 2011-12 The jQuery Project</p>
75+
</div>
76+
77+
</div><!-- /page -->
78+
79+
</body>
80+
</html>
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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 - Collapsible Sets</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>Collapsible sets (accordions)</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">
26+
<div class="content-primary">
27+
<h2>Collapsible sets</h2>
28+
29+
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
30+
<li><a href="content-collapsible-set.html" data-role="button" data-transition="fade">Basics</a></li>
31+
<li><a href="content-collapsible-set-options.html" data-role="button" data-transition="fade" class="ui-btn-active">Options</a></li>
32+
<li><a href="content-collapsible-set-methods.html" data-role="button" data-transition="fade">Methods</a></li>
33+
<li><a href="content-collapsible-set-events.html" data-role="button" data-transition="fade">Events</a></li>
34+
</ul>
35+
36+
<p>The collapsible plugin has the following options:</p>
37+
38+
<dl>
39+
<dt><code>iconpos</code> <em>string</em></dt>
40+
<dd>
41+
<p class="default">default: "left"</p>
42+
<p>Positions the icons in the collapsible headers. Possible values: left, right, top, bottom, none, notext.</p>
43+
<pre><code>$( document ).bind( "mobileinit", function(){
44+
<strong>$.mobile.collapsibleset.prototype.options.iconpos = "right";</strong>
45+
});
46+
</code></pre>
47+
<p>This option is also exposed as a data attribute: <code>data-iconpos=&quot;right&quot;</code>.</p>
48+
</dd>
49+
50+
<dt><code>initSelector</code> <em>CSS selector string</em></dt>
51+
<dd>
52+
<p class="default">default: ":jqmData(role='collapsible-set')"</p>
53+
<p>This is used to define the selectors (element types, data roles, etc.) that will automatically be initialized as collapsible sets. To change which elements are initialized, bind this option to the <a href="../../api/globalconfig.html">mobileinit event</a>:</p>
54+
<pre><code>$( document ).bind( "mobileinit", function(){
55+
<strong>$.mobile.collapsibleset.prototype.options.initSelector = ".mycollapsibleset";</strong>
56+
});
57+
</code></pre>
58+
</dd>
59+
60+
<dt><code>mini</code> <em>boolean</em></dt>
61+
<dd>
62+
<p class="default">default: false</p>
63+
<p>Sets the size of the element to a more compact, <a href="../forms/forms-all-mini.html">mini version</a>. To set the value for all instances of this widget, bind this option to the <a href="../../api/globalconfig.html">mobileinit event</a>:</p>
64+
<pre><code>$( document ).bind( "mobileinit", function(){
65+
<strong>$.mobile.collapsibleset.prototype.options.mini = true;</strong>
66+
});
67+
</code></pre>
68+
<p>This option is also exposed as a data attribute: <code>data-mini=&quot;true&quot;</code>.</p>
69+
</dd>
70+
<dt><code>theme</code> <em>string</em></dt>
71+
<dd>
72+
<p class="default">default: null, inherited from parent</p>
73+
<p>Sets the color scheme (swatch) for the collapsible set. It accepts a single letter from a-z that maps to the swatches included in your theme. To set the value for all instances of this widget, bind this option to the <a href="../../api/globalconfig.html">mobileinit event</a>:</p>
74+
<pre><code>$( document ).bind( "mobileinit", function(){
75+
<strong>$.mobile.collapsibleset.prototype.options.theme = "a";</strong>
76+
});
77+
</code></pre>
78+
<p>This option is also exposed as a data attribute: <code>data-theme=&quot;a&quot;</code>.</p>
79+
</dd>
80+
81+
</dl>
82+
</div><!--/content-primary -->
83+
84+
<div class="content-secondary">
85+
86+
<div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
87+
88+
<h3>More in this section</h3>
89+
90+
<ul data-role="listview" data-theme="c" data-dividertheme="d">
91+
92+
<li data-role="list-divider">Content Formatting</li>
93+
<li><a href="content-html.html">Basic HTML styles</a></li>
94+
<li><a href="content-grids.html">Layout grids (columns)</a></li>
95+
<li><a href="content-collapsible.html">Collapsible content blocks</a></li>
96+
<li data-theme="a"><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
97+
<li><a href="content-themes.html">Theming content</a></li>
98+
99+
</ul>
100+
</div>
101+
</div>
102+
103+
</div><!-- /content -->
104+
105+
<div data-role="footer" class="footer-docs" data-theme="c">
106+
<p>&copy; 2011-12 The jQuery Project</p>
107+
</div>
108+
109+
</div><!-- /page -->
110+
111+
</body>
112+
</html>

docs/content/content-collapsible-set.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,22 @@
1717
<div data-role="page" class="type-interior">
1818

1919
<div data-role="header" data-theme="f">
20-
<h1>Collapsible sets (Accordions)</h1>
20+
<h1>Collapsible sets (accordions)</h1>
2121
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a>
2222
<a href="../nav.html" data-icon="search" data-iconpos="notext" data-rel="dialog" data-transition="fade">Search</a>
2323
</div><!-- /header -->
2424

2525
<div data-role="content">
2626
<div class="content-primary">
27-
2827
<h2>Collapsible set markup</h2>
28+
29+
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
30+
<li><a href="content-collapsible-set.html" data-role="button" data-transition="fade" class="ui-btn-active">Basics</a></li>
31+
<li><a href="content-collapsible-set-options.html" data-role="button" data-transition="fade">Options</a></li>
32+
<li><a href="content-collapsible-set-methods.html" data-role="button" data-transition="fade">Methods</a></li>
33+
<li><a href="content-collapsible-set-events.html" data-role="button" data-transition="fade">Events</a></li>
34+
</ul>
35+
2936
<p>Collapsible sets start with the exact same markup as <a href="content-collapsible.html">individual collapsibles</a>. By adding a parent wrapper with a <code> data-role="collapsible-set"</code> attribute around a number of collapsibles, the framework will style these to looks like a visually grouped widget and make it behave like an accordion so only one section can be open at a time. View the <a href="../api/data-attributes.html">data- attribute reference</a> to see all the possible attributes you can add to collapsible sets.</p>
3037
<p>By default, all the sections will be collapsed. To set a section to be open when the page loads, add the <code> data-collapsed="false"</code> attribute to the heading of the section you want expanded.</p>
3138

0 commit comments

Comments
 (0)