Export 0.1.45
[framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.1.0 / docs / content / content-collapsible-set.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 - 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 set</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 set (accordion)</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
36                 <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>
37                 <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>
38
39         <pre><code>             
40 <strong>&lt;div data-role="collapsible-set"&gt;</strong>
41
42         &lt;div data-role=&quot;collapsible&quot; <strong>data-collapsed=&quot;false&quot;</strong>&gt;
43         &lt;h3&gt;Section 1&lt;/h3&gt;
44         &lt;p&gt;I&#x27;m the collapsible set content for section B.&lt;/p&gt;
45         &lt;/div&gt;
46         
47         &lt;div data-role=&quot;collapsible&quot;&gt;
48         &lt;h3&gt;Section 2&lt;/h3&gt;
49         &lt;p&gt;I&#x27;m the collapsible set content for section B.&lt;/p&gt;
50         &lt;/div&gt;
51         
52 <strong>&lt;/div&gt;</strong>
53         </code></pre>   
54         
55
56                 <p>Here is an example of a collapsible set with 5 sections.</p>
57                 
58                 <div data-role="collapsible-set">
59                         <div data-role="collapsible" data-collapsed="false">
60                                 <h3>Section 1</h3>
61                                 <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>
62                         </div>
63                         <div data-role="collapsible">
64                                 <h3>Section 2</h3>
65                                 <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>
66                         </div>
67                         <div data-role="collapsible">
68                                 <h3>Section 3</h3>
69                                 <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>
70                         </div>
71                         <div data-role="collapsible">
72                                 <h3>Section 4</h3>
73                                 <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>
74                         </div>
75                         <div data-role="collapsible">
76                                 <h3>Section 5</h3>
77                                 <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>
78                         </div>
79                 </div>
80
81                 <h2>Mini collapsible sets</h2>
82
83                 <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>
84                 
85                 <div data-role="collapsible-set" data-theme="c" data-content-theme="d" data-mini="true">
86                         <div data-role="collapsible">
87                                 <h3>Section 1</h3>
88                                 <p>Collapsible content</p>
89                         </div>
90                         <div data-role="collapsible">
91                                 <h3>Section 2</h3>
92                                 <p>Collapsible content</p>
93
94                         </div>
95                         <div data-role="collapsible">
96                                 <h3>Section 3</h3>
97                                 <p>Collapsible content</p>
98                         </div>
99                 </div>
100                 
101                 <h2>Icon positioning</h2>
102                 <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>
103                 
104                 <div data-role="collapsible-set" data-theme="c" data-iconpos="right">
105                         <div data-role="collapsible">
106                                 <h3>Section 1</h3>
107                                 <p>Inherits icon positioning from <code>data-iconpos="right"</code> attribute on parent.</p>
108                         </div>
109                         <div data-role="collapsible" data-iconpos="left">
110                                 <h3>Section 2</h3>
111                                 <p>data-iconpos="left"</p>
112                         </div>
113                         <div data-role="collapsible" data-iconpos="bottom">
114                                 <h3>Section 3</h3>
115                                 <p>data-iconpos="bottom"</p>
116                         </div>
117                         <div data-role="collapsible" data-iconpos="top">
118                                 <h3>Section 4</h3>
119                                 <p>data-iconpos="top"</p>
120                         </div>
121                 </div>
122                 
123                 
124                 
125                 <h2>Theming collapsible content</h2>
126                 <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>
127
128
129 <pre><code>             
130 &lt;div data-role=&quot;collapsible-set&quot; <strong>data-theme=&quot;c&quot; data-content-theme=&quot;d&quot;</strong>&gt;
131 </code></pre>   
132
133
134                 <div data-role="collapsible-set" data-theme="c" data-content-theme="d">
135                         <div data-role="collapsible">
136                                 <h3>Section 1</h3>
137                                 <p>Collapsible content</p>
138                         </div>
139                         <div data-role="collapsible">
140                                 <h3>Section 2</h3>
141                                 <p>Collapsible content</p>
142
143                         </div>
144                         <div data-role="collapsible">
145                                 <h3>Section 3</h3>
146                                 <p>Collapsible content</p>
147                         </div>
148                 </div>
149
150                 <h2>Theming individual sections</h2>
151                 <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>
152
153                 <div data-role="collapsible-set" data-content-theme="c">
154                         <div data-role="collapsible" data-theme="b" data-content-theme="b">
155                                 <h3>Section header, swatch B</h3>
156                                 <p>Collapsible content, swatch B</p>
157                         </div>
158                         <div data-role="collapsible" data-theme="a" data-content-theme="a">
159                                 <h3>Section header, swatch A</h3>
160                                 <p>Collapsible content, swatch A</p>
161                         </div>
162                         <div data-role="collapsible" data-theme="e" data-content-theme="d">
163                                 <h3>Section header, swatch E</h3>
164                                 <p>Collapsible content, swatch D</p>
165                         </div>
166                 </div>
167                 
168         </div><!--/content-primary -->          
169         
170         <div class="content-secondary">
171                 
172                 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
173                         
174                                 <h3>More in this section</h3>
175                                 
176                                 <ul data-role="listview" data-theme="c" data-dividertheme="d">
177                                 
178                                         <li data-role="list-divider">Content Formatting</li>
179                                         <li><a href="content-html.html">Basic HTML styles</a></li>
180                                         <li><a href="content-grids.html">Layout grids (columns)</a></li>
181                                         <li><a href="content-collapsible.html">Collapsible content blocks</a></li>
182                                         <li data-theme="a"><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
183                                         <li><a href="content-themes.html">Theming content</a></li>
184         
185                                 </ul>
186                 </div>
187         </div>          
188
189 </div><!-- /content -->
190
191 <div data-role="footer" class="footer-docs" data-theme="c">
192                 <p>&copy; 2011-12 The jQuery Foundation</p>
193 </div>
194         
195 </div><!-- /page -->
196
197 </body>
198 </html>