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>
16 <div data-role="page" class="type-interior">
18 <div data-role="header" data-theme="f">
19 <h1>Collapsible sets (Accordions)</h1>
20 <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
21 </div><!-- /header -->
23 <div data-role="content">
24 <div class="content-primary">
26 <h2>Collapsible set markup</h2>
27 <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>
28 <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>
31 <strong><div data-role="collapsible-set"></strong>
33 <div data-role="collapsible" <strong>data-collapsed="false"</strong>>
34 <h3>Section 1</h3>
35 <p>I'm the collapsible set content for section B.</p>
38 <div data-role="collapsible">
39 <h3>Section 2</h3>
40 <p>I'm the collapsible set content for section B.</p>
43 <strong></div></strong>
47 <p>Here is an example of a collapsible set with 5 sections.</p>
49 <div data-role="collapsible-set">
50 <div data-role="collapsible" data-collapsed="false">
52 <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>
54 <div data-role="collapsible">
56 <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>
59 <div data-role="collapsible">
61 <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>
64 <div data-role="collapsible">
66 <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>
69 <div data-role="collapsible">
71 <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>
76 <h2>Theming collapsible content</h2>
77 <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>
81 <div data-role="collapsible-set" <strong>data-theme="c" data-content-theme="d"</strong>>
85 <div data-role="collapsible-set" data-theme="c" data-content-theme="d">
86 <div data-role="collapsible">
88 <p>Collapsible content</p>
90 <div data-role="collapsible">
92 <p>Collapsible content</p>
95 <div data-role="collapsible">
97 <p>Collapsible content</p>
102 <h2>Theming individual sections</h2>
103 <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>
105 <div data-role="collapsible-set" data-content-theme="c">
106 <div data-role="collapsible" data-theme="b" data-content-theme="b">
107 <h3>Section header, swatch B</h3>
108 <p>Collapsible content, swatch B</p>
111 <div data-role="collapsible" data-theme="a" data-content-theme="a">
112 <h3>Section header, swatch A</h3>
113 <p>Collapsible content, swatch A</p>
115 <div data-role="collapsible" data-theme="e" data-content-theme="d">
116 <h3>Section header, swatch E</h3>
117 <p>Collapsible content, swatch D</p>
121 </div><!--/content-primary -->
123 <div class="content-secondary">
125 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
127 <h3>More in this section</h3>
129 <ul data-role="listview" data-theme="c" data-dividertheme="d">
131 <li data-role="list-divider">Content Formatting</li>
132 <li><a href="content-html.html">Basic HTML styles</a></li>
133 <li><a href="content-grids.html">Layout grids (columns)</a></li>
134 <li><a href="content-collapsible.html">Collapsible content blocks</a></li>
135 <li data-theme="a"><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
136 <li><a href="content-themes.html">Theming content</a></li>
142 </div><!-- /content -->
144 <div data-role="footer" class="footer-docs" data-theme="c">
145 <p>© 2011 The jQuery Project</p>