/
accordion.xml
183 lines (167 loc) · 7.94 KB
/
accordion.xml
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
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="../../entries2html.xsl" ?>
<entry name="accordion" namespace="fn" type="Widget" widgetnamespace="ui">
<longdesc>
<p>Make the selected elements Accordion widgets. Semantic requirements:</p>
<p>The markup of your accordion container needs pairs of headers and content panels:</p>
<pre><![CDATA[<div id="accordion">
<h3><a href="#">First header</a></h3>
<div>First content</div>
<h3><a href="#">Second header</a></h3>
<div>Second content</div>
</div>]]></pre>
<p>If you use a different element for the header, specify the header-option with an appropriate selector, eg. header: 'a.header'. The content element must be always next to its header.</p>
<p>If you have links inside the accordion content and use a-elements as headers, add a class to them and use that as the header, eg. header: 'a.header'.</p>
<p>Use activate(Number) to change the active content programmatically.</p>
<h4>NOTE: If you want multiple sections open at once, don't use an accordion</h4>
<p>An accordion doesn't allow more than one content panel to be open at the same time, and it takes a lot of effort to do that. If you are looking for a widget that allows more than one content panel to be open, don't use this. Usually it can be written with a few lines of jQuery instead, something like this:</p>
<pre><![CDATA[jQuery(document).ready(function(){
$('.accordion .head').click(function() {
$(this).next().toggle();
return false;
}).next().hide();
});]]></pre>
<p>Or animated:</p>
<pre><![CDATA[jQuery(document).ready(function(){
$('.accordion .head').click(function() {
$(this).next().toggle('slow');
return false;
}).next().hide();
});]]></pre>
</longdesc>
<created>1.0</created>
<options>
<option name="active" type="Selector, Element, jQuery, Boolean, Number" default='first child'>
<desc>Selector for the active element. Set to false to display none at start. Needs <code>collapsible: true</code>.</desc>
</option>
<option name="animated" type="Boolean, String" default='"slide"'>
<desc>Choose your favorite animation, or disable them (set to false). In addition to the default, 'bounceslide' and all defined easing methods are supported ('bounceslide' requires UI Effects Core).</desc>
</option>
<option name="autoHeight" type="Boolean" default='true'>
<desc>If set, the highest content part is used as height reference for all other parts. Provides more consistent animations.</desc>
</option>
<option name="clearStyle" type="Boolean" default='false'>
<desc>If set, clears height and overflow styles after finishing animations. This enables accordions to work with dynamic content. Won't work together with autoHeight.</desc>
</option>
<option name="collapsible" type="Boolean" default='false'>
<desc>Whether all the sections can be closed at once. Allows collapsing the active section by the triggering event (click is the default).</desc>
</option>
<option name="event" type="String" default='"click"'>
<desc>The event on which to trigger the accordion.</desc>
</option>
<option name="fillSpace" type="Boolean" default='false'>
<desc>If set, the accordion completely fills the height of the parent element. Overrides autoheight.</desc>
</option>
<option name="header" type="Selector, jQuery" default='"> li > :first-child,> :not(li):even"'>
<desc>Selector for the header element.</desc>
</option>
<option name="icons" type="Object" default='{ "header": "ui-icon-triangle-1-e", "headerSelected": "ui-icon-triangle-1-s" }'>
<desc>Icons to use for headers. Icons may be specified for 'header' and 'headerSelected', and we recommend using the icons native to the jQuery UI CSS Framework manipulated by [http://www.themeroller.com jQuery UI ThemeRoller]. Set to false to have no icons displayed.</desc>
</option>
<option name="navigation" type="Boolean" default='false'>
<desc>If set, looks for the anchor that matches location.href and activates it. Great for href-based state-saving. Use navigationFilter to implement your own matcher.</desc>
</option>
<option name="navigationFilter" type="Function" default=' '>
<desc>Overwrite the default location.href-matching with your own matcher.</desc>
</option>
</options>
<events>
<event name="change" type="accordionchange">
<desc>This event is triggered every time the accordion changes. If the accordion is animated, the event will be triggered upon completion of the animation; otherwise, it is triggered immediately.
<pre><![CDATA[$('.ui-accordion').bind('accordionchange', function(event, ui) {
ui.newHeader // jQuery object, activated header
ui.oldHeader // jQuery object, previous header
ui.newContent // jQuery object, activated content
ui.oldContent // jQuery object, previous content
});]]></pre>
</desc>
<argument name="event" type="Event">
<desc></desc>
</argument>
<argument name="ui" type="Object">
<desc></desc>
</argument>
</event>
<event name="changestart" type="accordionchangestart">
<desc>This event is triggered every time the accordion starts to change.
<pre><![CDATA[$('.ui-accordion').bind('accordionchangestart', function(event, ui) {
ui.newHeader // jQuery object, activated header
ui.oldHeader // jQuery object, previous header
ui.newContent // jQuery object, activated content
ui.oldContent // jQuery object, previous content
});]]></pre>
</desc>
<argument name="event" type="Event">
<desc></desc>
</argument>
<argument name="ui" type="Object">
<desc></desc>
</argument>
</event>
</events>
<methods>
<method name="activate">
<desc>Activate a content part of the Accordion programmatically. The index can be a zero-indexed number to match the position of the header to close or a Selector matching an element. Pass <code>false</code> to close all (only possible with <code>collapsible:true</code>).</desc>
<argument name="index" type="String, Element, jQuery, Boolean, Number">
<desc></desc>
</argument>
</method>
<method name="resize">
<desc>Recompute heights of the accordion contents when using the fillSpace option and the container height changed. For example, when the container is a resizable, this method should be called by its resize-event.</desc>
</method>
</methods>
<example>
<desc>A simple jQuery UI Accordion.</desc>
<code><![CDATA[$("#accordion").accordion();]]></code>
<html><![CDATA[
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
suscipit faucibus urna.
</p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
</p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est.
</p>
<p>
Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.
</p>
</div>
</div>
]]></html>
</example>
</entry>