tizen beta release
[framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.0.1pre / docs / content / content-collapsible.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/" />  
8         <link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
9         <script src="../../js/jquery.js"></script>
10         <script src="../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
11         <script src="../_assets/js/jqm-docs.js"></script>
12         <script src="../../js/"></script>
13 </head> 
14 <body> 
15
16         <div data-role="page" class="type-interior">
17
18                 <div data-role="header" data-theme="f">
19                 <h1>Collapsible content</h1>
20                 <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
21         </div><!-- /header -->
22
23         <div data-role="content">
24                 <div class="content-primary">
25                 
26                 <h2>Collapsible content markup</h2>
27                 <p>To create a collapsible block of content, create a container and add the <code> data-role="collapsible"</code> attribute. Using <code>data-content-theme</code> attribute allows you to set a theme for the content of the collapsible. View the <a href="../api/data-attributes.html">data- attribute reference</a> to see all the possible attributes you can add to collapsibles.</p>
28
29                 <p>Directly inside this container, add any header element (H1-H6). The framework will style the header to look like a clickable button and add a "+" icon to the left to indicate it's expandable.</p>
30         
31                 <p>After the header, add any HTML markup you want to be collapsible. The framework will wrap this markup in a container that will be hidden/shown when the heading is clicked.</p>
32                 
33                 <p>By default, the content will be collapsed.</p>
34 <pre><code>             
35 &lt;div <strong>data-role=&quot;collapsible&quot;</strong>&gt;
36    &lt;h3&gt;I&#x27;m a header&lt;/h3&gt;
37    &lt;p&gt;I&#x27;m the collapsible content. By default I'm closed, but you can click the header to open me.&lt;/p&gt;
38 &lt;/div&gt;
39 </code></pre>   
40         
41
42                         <div data-role="collapsible">
43                                 <h3>I'm a header</h3>
44                                 <p>I'm the collapsible content. By default I'm closed, but you can click the header to open me.</p>
45                         </div>
46
47         <h2>Expanding collapsibles on load</h2>
48                         
49                 <p>To expand the content when the page loads, add the <code>data-collapsed="false"</code> attribute to the wrapper.</p>
50
51         <code>          
52         &lt;div data-role=&quot;collapsible&quot; <strong>data-collapsed=&quot;false&quot;&gt;</strong>
53         </code>
54
55                 <p>This code will create a collapsible widget like this:</p>
56         
57
58                         <div data-role="collapsible" data-collapsed="false">
59                                 <h3>I'm a header</h3>
60                                 <p>I'm the collapsible content. I'm expanded by default because I have the "collapsed" state set to false.</p>
61                         </div>
62         
63         <h2>Theming collapsible content</h2>
64         
65                 
66                 <p>Collapsible content is minimally styled &mdash; we add only a bit of margin between the bar and content, and the header adopts the default Theme styles of the container it sits within.</p>
67                 
68                 <p>To provide a stronger visual connection between the collapsible header and content, add the <code>data-content-theme</code> attribute to the wrapper and specify a theme swatch letter. This will apply the swatch's border and <em>flat</em> background color (not the gradient) to the content block and changes the corner rounding to square off the bottom of the header and round the bottom of the content block instead to visually group these elements.</p>
69                 
70 <pre><code>             
71 &lt;div data-role=&quot;collapsible&quot; <strong>data-content-theme=&quot;c&quot;</strong>&gt;
72    &lt;h3&gt;Header swatch A&lt;/h3&gt;
73    &lt;p&gt;I&#x27;m the collapsible content with a themed content block set to "C".&lt;/p&gt;
74 &lt;/div&gt;
75 </code></pre>
76                 
77                 <div data-role="collapsible" data-content-theme="c">
78                         <h3>Header swatch</h3>
79                         <p>I'm the collapsible content with a themed content block set to "C".</p>
80                 </div>
81                 
82                 <h2>Theming collapsible headers</h2>
83                 <p>To set the theme on a collapsible header button, add the <code>data-theme</code> attribute to the wrapper and specify a swatch letter. Note that you can mix and match swatch letters between the header and content with these theme attributes.</p>
84
85 <pre><code>             
86 &lt;div data-role=&quot;collapsible&quot; <strong>data-theme=&quot;a&quot; data-content-theme=&quot;a&quot;</strong>&gt;
87    &lt;h3&gt;Header swatch A&lt;/h3&gt;
88    &lt;p&gt;I&#x27;m the collapsible content with a themed content block set to "A".&lt;/p&gt;
89 &lt;/div&gt;
90 </code></pre>
91                 
92                 <div data-role="collapsible" data-theme="a" data-content-theme="a">
93                         <h3>Header swatch A</h3>
94                         <p>I'm the collapsible content with a themed content block set to "A".</p>
95                 </div>
96
97
98                 
99                 <div data-role="collapsible" data-theme="b" data-content-theme="d">
100                         <h3>Header swatch B</h3>
101                         <p>I'm the collapsible content with a themed content block set to "D".</p>
102                 </div>
103
104                 
105                 
106                 <h2>Nested Collapsibles</h2>
107                 
108                 <p>Collapsibles can be nested inside each other if needed. In this example, we're setting the content theme to provide clearer visual connection between the levels.</p>
109                 <div data-role="collapsible" data-collapsed="false" data-theme="e" data-content-theme="c">
110                         <h3>I'm a header</h3>
111                         <p>I'm the collapsible content. By default I'm open and displayed on the page, but you can click the header to hide me.</p>
112                         
113                         <div data-role="collapsible" data-theme="c" data-content-theme="c">
114                                 <h3>I'm a nested collapsible with a child collapsible</h3>
115                                 <p>I'm a child collapsible.</p>
116                                         <div data-role="collapsible" data-theme="d" data-content-theme="d">
117                                                 <h3>Nested inside again.</h3>
118                                                 <p>Three levels deep now.</p>
119                                         </div><!-- /section 1A -->
120                         </div><!-- /section 1 -->
121
122                         
123                         <div data-role="collapsible" data-content-theme="c">
124                                 <h3>Section 3: Form elements</h3>
125                                 <form action="#" method="get">
126                                         <div data-role="fieldcontain">
127                                                 <label for="textarea">Textarea:</label>
128                                                 <textarea cols="40" rows="8" name="textarea" id="textarea"></textarea>
129                                         </div>
130                                         <div data-role="fieldcontain">
131                                                 <label for="slider">Input slider:</label>
132                                                 <input type="range" name="slider" id="slider" value="0" min="0" max="100"  />
133                                         </div>
134                                         <fieldset class="ui-grid-a">
135                                                         <div class="ui-block-a"><button type="submit" data-theme="c">Cancel</button></div>
136                                                         <div class="ui-block-b"><button type="submit" data-theme="b">Submit</button></div>         
137                                     </fieldset>
138                                 </form>
139                         </div><!-- /section 2 -->
140
141                         <div data-role="collapsible" data-content-theme="c">
142                                 <h3>Section 4: Collapsed list</h3>
143                                 <p>Here is an inset list:</p>
144                                 <ul data-role="listview" data-inset="true" data-theme="d">
145                                         <li><a href="index.html">Acura</a></li>
146                                         <li><a href="index.html">Audi</a></li>
147                                         <li><a href="index.html">BMW</a></li>
148                                         <li><a href="index.html">Cadillac</a></li>
149                                         <li><a href="index.html">Chrysler</a></li>
150                                         <li><a href="index.html">Dodge</a></li>
151                                         <li><a href="index.html">Ferrari</a></li>
152                                         <li><a href="index.html">Ford</a></li>
153                                 </ul>
154                         </div><!-- /section 3 -->
155                 </div>
156                 
157                 
158                 
159                 <h2>Collapsible sets (accordions)</h2>
160                 <p>It's possible to combine multiple collapsibles into a grouped sets that acts like an accordion widget. <a href="content-collapsible-set.html">Learn more</a></p>
161                 
162                 
163         </div><!--/content-primary -->          
164         
165         <div class="content-secondary">
166                 
167                 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
168                         
169                                 <h3>More in this section</h3>
170                                 
171                                 <ul data-role="listview" data-theme="c" data-dividertheme="d">
172                                 
173                                         <li data-role="list-divider">Content Formatting</li>
174                                         <li><a href="content-html.html">Basic HTML styles</a></li>
175                                         <li><a href="content-grids.html">Layout grids (columns)</a></li>
176                                         <li data-theme="a"><a href="content-collapsible.html">Collapsible content blocks</a></li>
177                                         <li><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
178                                         <li><a href="content-themes.html">Theming content</a></li>
179         
180                                 </ul>
181                 </div>
182         </div>
183
184 </div><!-- /content -->
185
186 <div data-role="footer" class="footer-docs" data-theme="c">
187                 <p>&copy; 2011 The jQuery Project</p>
188 </div>
189         
190 </div><!-- /page -->
191
192 </body>
193 </html>