This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
content-collapsible-set.html
198 lines (157 loc) · 8.05 KB
/
content-collapsible-set.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Docs - Collapsible Content</title>
<link rel="stylesheet" href="../../css/themes/default/jquery.mobile.css" />
<link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
<script src="../../js/jquery.js"></script>
<script src="../../docs/_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>Collapsible set</h1>
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a>
<a href="../nav.html" data-icon="search" data-iconpos="notext" data-rel="dialog" data-transition="fade">Search</a>
</div><!-- /header -->
<div data-role="content">
<div class="content-primary">
<h2>Collapsible set (accordion)</h2>
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
<li><a href="content-collapsible-set.html" data-role="button" data-transition="fade" class="ui-btn-active">Basics</a></li>
<li><a href="content-collapsible-set-options.html" data-role="button" data-transition="fade">Options</a></li>
<li><a href="content-collapsible-set-methods.html" data-role="button" data-transition="fade">Methods</a></li>
<li><a href="content-collapsible-set-events.html" data-role="button" data-transition="fade">Events</a></li>
</ul>
<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>
<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>
<pre><code>
<strong><div data-role="collapsible-set"></strong>
<div data-role="collapsible" <strong>data-collapsed="false"</strong>>
<h3>Section 1</h3>
<p>I'm the collapsible set content for section B.</p>
</div>
<div data-role="collapsible">
<h3>Section 2</h3>
<p>I'm the collapsible set content for section B.</p>
</div>
<strong></div></strong>
</code></pre>
<p>Here is an example of a collapsible set with 5 sections.</p>
<div data-role="collapsible-set">
<div data-role="collapsible" data-collapsed="false">
<h3>Section 1</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm open by default because I have the <code>data-collapsed="false"</code> attribute.</p>
</div>
<div data-role="collapsible">
<h3>Section 2</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
</div>
<div data-role="collapsible">
<h3>Section 3</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
</div>
<div data-role="collapsible">
<h3>Section 4</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
</div>
<div data-role="collapsible">
<h3>Section 5</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
</div>
</div>
<h2>Mini collapsible sets</h2>
<p>For a more compact version that is useful in tight spaces, add the <code>data-mini="true"</code> attribute to the element to create a <a href="../forms/forms-all-mini.html">mini version</a>. </p>
<div data-role="collapsible-set" data-theme="c" data-content-theme="d" data-mini="true">
<div data-role="collapsible">
<h3>Section 1</h3>
<p>Collapsible content</p>
</div>
<div data-role="collapsible">
<h3>Section 2</h3>
<p>Collapsible content</p>
</div>
<div data-role="collapsible">
<h3>Section 3</h3>
<p>Collapsible content</p>
</div>
</div>
<h2>Icon positioning</h2>
<p>Collapsible headings’ default icon positioing can be overridden by using the <code>data-iconpos</code> attribute, either at the <code>collapsible-set</code> level or on an individual collapsible basis.</p>
<div data-role="collapsible-set" data-theme="c" data-iconpos="right">
<div data-role="collapsible">
<h3>Section 1</h3>
<p>Inherits icon positioning from <code>data-iconpos="right"</code> attribute on parent.</p>
</div>
<div data-role="collapsible" data-iconpos="left">
<h3>Section 2</h3>
<p>data-iconpos="left"</p>
</div>
<div data-role="collapsible" data-iconpos="bottom">
<h3>Section 3</h3>
<p>data-iconpos="bottom"</p>
</div>
<div data-role="collapsible" data-iconpos="top">
<h3>Section 4</h3>
<p>data-iconpos="top"</p>
</div>
</div>
<h2>Theming collapsible content</h2>
<p>The standard <code>data-theme</code> attribute can be used to set the color of each collapsible in a set. To provide a clearer visual grouping of the content with the headers, add the <code>data-content-theme</code> attribute with a swatch letter. This adds a themed background color and border to the content block. For consistent theming, add these attributes to the parent collapsible set.</p>
<pre><code>
<div data-role="collapsible-set" <strong>data-theme="c" data-content-theme="d"</strong>>
</code></pre>
<div data-role="collapsible-set" data-theme="c" data-content-theme="d">
<div data-role="collapsible">
<h3>Section 1</h3>
<p>Collapsible content</p>
</div>
<div data-role="collapsible">
<h3>Section 2</h3>
<p>Collapsible content</p>
</div>
<div data-role="collapsible">
<h3>Section 3</h3>
<p>Collapsible content</p>
</div>
</div>
<h2>Theming individual sections</h2>
<p>To have individual sections in a group styled differently, add <code>data-theme</code> and <code>data-content-theme</code> attributes to specific collapsibles.</p>
<div data-role="collapsible-set" data-content-theme="c">
<div data-role="collapsible" data-theme="b" data-content-theme="b">
<h3>Section header, swatch B</h3>
<p>Collapsible content, swatch B</p>
</div>
<div data-role="collapsible" data-theme="a" data-content-theme="a">
<h3>Section header, swatch A</h3>
<p>Collapsible content, swatch A</p>
</div>
<div data-role="collapsible" data-theme="e" data-content-theme="d">
<h3>Section header, swatch E</h3>
<p>Collapsible content, swatch D</p>
</div>
</div>
</div><!--/content-primary -->
<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">Content Formatting</li>
<li><a href="content-html.html">Basic HTML styles</a></li>
<li><a href="content-grids.html">Layout grids (columns)</a></li>
<li><a href="content-collapsible.html">Collapsible content blocks</a></li>
<li data-theme="a"><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
<li><a href="content-themes.html">Theming content</a></li>
</ul>
</div>
</div>
</div><!-- /content -->
<div data-role="footer" class="footer-docs" data-theme="c">
<p>© 2011-12 The jQuery Foundation</p>
</div>
</div><!-- /page -->
</body>
</html>