client/player/development-bundle/docs/accordion.html
changeset 57 3a3c15c462f8
parent 48 44d58d2e90b5
parent 56 da0957782d03
child 58 ec1d0e7dcb53
equal deleted inserted replaced
48:44d58d2e90b5 57:3a3c15c462f8
     1 
       
     2 <ul class="UIAPIPlugin-toc">
       
     3 <li><a href="#overview">Overview</a></li>
       
     4 <li><a href="#options">Options</a></li>
       
     5 <li><a href="#events">Events</a></li>
       
     6 <li><a href="#methods">Methods</a></li>
       
     7 <li><a href="#theming">Theming</a></li>
       
     8 </ul>
       
     9 <div class="UIAPIPlugin">
       
    10   <h1>jQuery UI Accordion</h1>
       
    11   <div id="overview">
       
    12     <h2 class="top-header">Overview</h2>
       
    13     <div id="overview-main">
       
    14         <p>Make the selected elements Accordion widgets. Semantic requirements:</p>
       
    15 <p>The markup of your accordion container needs pairs of headers and content panels:</p>
       
    16 <pre>&lt;div id=&quot;accordion&quot;&gt;
       
    17     &lt;h3&gt;&lt;a href=&quot;#&quot;&gt;First header&lt;/a&gt;&lt;/h3&gt;
       
    18     &lt;div&gt;First content&lt;/div&gt;
       
    19     &lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Second header&lt;/a&gt;&lt;/h3&gt;
       
    20     &lt;div&gt;Second content&lt;/div&gt;
       
    21 &lt;/div&gt;</pre>
       
    22 <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>
       
    23 <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>
       
    24 <p>Use activate(Number) to change the active content programmatically.</p>
       
    25 <div class="editsection" style="float:right;margin-left:5px;">[<a href="http://docs.jquery.com/action/edit/UI/API/1.8/Accordion?section=1" title="Edit section: NOTE: If you want multiple sections open at once, don't use an accordion">edit</a>]</div><a name="NOTE:_If_you_want_multiple_sections_open_at_once.2C_don.27t_use_an_accordion"></a><h4>NOTE: If you want multiple sections open at once, don't use an accordion</h4>
       
    26 <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>
       
    27 <pre>jQuery(document).ready(function(){
       
    28 	$('.accordion .head').click(function() {
       
    29 		$(this).next().toggle();
       
    30 		return false;
       
    31 	}).next().hide();
       
    32 });</pre>
       
    33 <p>Or animated:</p>
       
    34 <pre>jQuery(document).ready(function(){
       
    35 	$('.accordion .head').click(function() {
       
    36 		$(this).next().toggle('slow');
       
    37 		return false;
       
    38 	}).next().hide();
       
    39 });</pre>
       
    40     </div>
       
    41     <div id="overview-dependencies">
       
    42         <h3>Dependencies</h3>
       
    43         <ul>
       
    44 <li>UI Core</li>
       
    45 <li>UI Effects Core (Optional - only for non-default animations)</li>
       
    46 </ul>
       
    47     </div>
       
    48     <div id="overview-example">
       
    49         <h3>Example</h3>
       
    50         <div id="overview-example" class="example">
       
    51 <ul><li><a href="#demo"><span>Demo</span></a></li><li><a href="#source"><span>View Source</span></a></li></ul>
       
    52 <p><div id="demo" class="tabs-container" rel="310">
       
    53 A simple jQuery UI Accordion.<br />
       
    54 </p>
       
    55 <pre>$(&quot;#accordion&quot;).accordion();
       
    56 </pre>
       
    57 <p></div><div id="source" class="tabs-container">
       
    58 </p>
       
    59 <pre>&lt;!DOCTYPE html&gt;
       
    60 &lt;html&gt;
       
    61 &lt;head&gt;
       
    62   &lt;link href=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
       
    63   &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
       
    64   &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js&quot;&gt;&lt;/script&gt;
       
    65   
       
    66   &lt;script&gt;
       
    67   $(document).ready(function() {
       
    68     $(&quot;#accordion&quot;).accordion();
       
    69   });
       
    70   &lt;/script&gt;
       
    71 &lt;/head&gt;
       
    72 &lt;body style="font-size:62.5%;"&gt;
       
    73   
       
    74 &lt;div id=&quot;accordion&quot;&gt;
       
    75 	&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Section 1&lt;/a&gt;&lt;/h3&gt;
       
    76 	&lt;div&gt;
       
    77 		&lt;p&gt;
       
    78 		Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
       
    79 		ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
       
    80 		amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
       
    81 		odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
       
    82 		&lt;/p&gt;
       
    83 	&lt;/div&gt;
       
    84 	&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Section 2&lt;/a&gt;&lt;/h3&gt;
       
    85 	&lt;div&gt;
       
    86 		&lt;p&gt;
       
    87 		Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
       
    88 		purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
       
    89 		velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
       
    90 		suscipit faucibus urna.
       
    91 		&lt;/p&gt;
       
    92 	&lt;/div&gt;
       
    93 	&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Section 3&lt;/a&gt;&lt;/h3&gt;
       
    94 	&lt;div&gt;
       
    95 		&lt;p&gt;
       
    96 		Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
       
    97 		Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
       
    98 		ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
       
    99 		lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
       
   100 		&lt;/p&gt;
       
   101 		&lt;ul&gt;
       
   102 			&lt;li&gt;List item one&lt;/li&gt;
       
   103 			&lt;li&gt;List item two&lt;/li&gt;
       
   104 			&lt;li&gt;List item three&lt;/li&gt;
       
   105 		&lt;/ul&gt;
       
   106 	&lt;/div&gt;
       
   107 	&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Section 4&lt;/a&gt;&lt;/h3&gt;
       
   108 	&lt;div&gt;
       
   109 		&lt;p&gt;
       
   110 		Cras dictum. Pellentesque habitant morbi tristique senectus et netus
       
   111 		et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
       
   112 		faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
       
   113 		mauris vel est.
       
   114 		&lt;/p&gt;
       
   115 		&lt;p&gt;
       
   116 		Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
       
   117 		Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
       
   118 		inceptos himenaeos.
       
   119 		&lt;/p&gt;
       
   120 	&lt;/div&gt;
       
   121 &lt;/div&gt;
       
   122 
       
   123 &lt;/body&gt;
       
   124 &lt;/html&gt;
       
   125 </pre>
       
   126 <p></div>
       
   127 </p><p></div>
       
   128     </div>
       
   129   </div>
       
   130   <div id="options">
       
   131     <h2 class="top-header">Options</h2>
       
   132     <ul class="options-list">
       
   133       
       
   134 <li class="option" id="option-disabled">
       
   135   <div class="option-header">
       
   136     <h3 class="option-name"><a href="#option-disabled">disabled</a></h3>
       
   137     <dl>
       
   138       <dt class="option-type-label">Type:</dt>
       
   139         <dd class="option-type">Boolean</dd>
       
   140       
       
   141       <dt class="option-default-label">Default:</dt>
       
   142         <dd class="option-default">false</dd>
       
   143       
       
   144     </dl>
       
   145   </div>
       
   146   <div class="option-description">
       
   147     <p>Disables (true) or enables (false) the accordion. Can be set when initialising (first creating) the accordion.</p>
       
   148   </div>
       
   149   <div class="option-examples">
       
   150     <h4>Code examples</h4>
       
   151     <dl class="option-examples-list">
       
   152     
       
   153 <dt>
       
   154   Initialize a accordion with the <code>disabled</code> option specified.
       
   155 </dt>
       
   156 <dd>
       
   157 <pre><code>$( ".selector" ).accordion({ disabled: true });</code></pre>
       
   158 </dd>
       
   159 
       
   160     
       
   161 <dt>
       
   162   Get or set the <code>disabled</code> option, after init.
       
   163 </dt>
       
   164 <dd>
       
   165 <pre><code>//getter
       
   166 var disabled = $( ".selector" ).accordion( "option", "disabled" );
       
   167 //setter
       
   168 $( ".selector" ).accordion( "option", "disabled", true );</code></pre>
       
   169 </dd>
       
   170 
       
   171     </dl>
       
   172   </div>
       
   173 </li>
       
   174 
       
   175 
       
   176 <li class="option" id="option-active">
       
   177   <div class="option-header">
       
   178     <h3 class="option-name"><a href="#option-active">active</a></h3>
       
   179     <dl>
       
   180       <dt class="option-type-label">Type:</dt>
       
   181         <dd class="option-type">Selector, Element, jQuery, Boolean, Number</dd>
       
   182       
       
   183       <dt class="option-default-label">Default:</dt>
       
   184         <dd class="option-default">first child</dd>
       
   185       
       
   186     </dl>
       
   187   </div>
       
   188   <div class="option-description">
       
   189     <p>Selector for the active element. Set to false to display none at start. Needs <code>collapsible: true</code>.</p>
       
   190   </div>
       
   191   <div class="option-examples">
       
   192     <h4>Code examples</h4>
       
   193     <dl class="option-examples-list">
       
   194     
       
   195 <dt>
       
   196   Initialize a accordion with the <code>active</code> option specified.
       
   197 </dt>
       
   198 <dd>
       
   199 <pre><code>$( ".selector" ).accordion({ active: 2 });</code></pre>
       
   200 </dd>
       
   201 
       
   202     
       
   203 <dt>
       
   204   Get or set the <code>active</code> option, after init.
       
   205 </dt>
       
   206 <dd>
       
   207 <pre><code>//getter
       
   208 var active = $( ".selector" ).accordion( "option", "active" );
       
   209 //setter
       
   210 $( ".selector" ).accordion( "option", "active", 2 );</code></pre>
       
   211 </dd>
       
   212 
       
   213     </dl>
       
   214   </div>
       
   215 </li>
       
   216 
       
   217 
       
   218 <li class="option" id="option-animated">
       
   219   <div class="option-header">
       
   220     <h3 class="option-name"><a href="#option-animated">animated</a></h3>
       
   221     <dl>
       
   222       <dt class="option-type-label">Type:</dt>
       
   223         <dd class="option-type">Boolean, String</dd>
       
   224       
       
   225       <dt class="option-default-label">Default:</dt>
       
   226         <dd class="option-default">'slide'</dd>
       
   227       
       
   228     </dl>
       
   229   </div>
       
   230   <div class="option-description">
       
   231     <p>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).</p>
       
   232   </div>
       
   233   <div class="option-examples">
       
   234     <h4>Code examples</h4>
       
   235     <dl class="option-examples-list">
       
   236     
       
   237 <dt>
       
   238   Initialize a accordion with the <code>animated</code> option specified.
       
   239 </dt>
       
   240 <dd>
       
   241 <pre><code>$( ".selector" ).accordion({ animated: 'bounceslide' });</code></pre>
       
   242 </dd>
       
   243 
       
   244     
       
   245 <dt>
       
   246   Get or set the <code>animated</code> option, after init.
       
   247 </dt>
       
   248 <dd>
       
   249 <pre><code>//getter
       
   250 var animated = $( ".selector" ).accordion( "option", "animated" );
       
   251 //setter
       
   252 $( ".selector" ).accordion( "option", "animated", 'bounceslide' );</code></pre>
       
   253 </dd>
       
   254 
       
   255     </dl>
       
   256   </div>
       
   257 </li>
       
   258 
       
   259 
       
   260 <li class="option" id="option-autoHeight">
       
   261   <div class="option-header">
       
   262     <h3 class="option-name"><a href="#option-autoHeight">autoHeight</a></h3>
       
   263     <dl>
       
   264       <dt class="option-type-label">Type:</dt>
       
   265         <dd class="option-type">Boolean</dd>
       
   266       
       
   267       <dt class="option-default-label">Default:</dt>
       
   268         <dd class="option-default">true</dd>
       
   269       
       
   270     </dl>
       
   271   </div>
       
   272   <div class="option-description">
       
   273     <p>If set, the highest content part is used as height reference for all other parts. Provides more consistent animations.</p>
       
   274   </div>
       
   275   <div class="option-examples">
       
   276     <h4>Code examples</h4>
       
   277     <dl class="option-examples-list">
       
   278     
       
   279 <dt>
       
   280   Initialize a accordion with the <code>autoHeight</code> option specified.
       
   281 </dt>
       
   282 <dd>
       
   283 <pre><code>$( ".selector" ).accordion({ autoHeight: false });</code></pre>
       
   284 </dd>
       
   285 
       
   286     
       
   287 <dt>
       
   288   Get or set the <code>autoHeight</code> option, after init.
       
   289 </dt>
       
   290 <dd>
       
   291 <pre><code>//getter
       
   292 var autoHeight = $( ".selector" ).accordion( "option", "autoHeight" );
       
   293 //setter
       
   294 $( ".selector" ).accordion( "option", "autoHeight", false );</code></pre>
       
   295 </dd>
       
   296 
       
   297     </dl>
       
   298   </div>
       
   299 </li>
       
   300 
       
   301 
       
   302 <li class="option" id="option-clearStyle">
       
   303   <div class="option-header">
       
   304     <h3 class="option-name"><a href="#option-clearStyle">clearStyle</a></h3>
       
   305     <dl>
       
   306       <dt class="option-type-label">Type:</dt>
       
   307         <dd class="option-type">Boolean</dd>
       
   308       
       
   309       <dt class="option-default-label">Default:</dt>
       
   310         <dd class="option-default">false</dd>
       
   311       
       
   312     </dl>
       
   313   </div>
       
   314   <div class="option-description">
       
   315     <p>If set, clears height and overflow styles after finishing animations. This enables accordions to work with dynamic content. Won't work together with autoHeight.</p>
       
   316   </div>
       
   317   <div class="option-examples">
       
   318     <h4>Code examples</h4>
       
   319     <dl class="option-examples-list">
       
   320     
       
   321 <dt>
       
   322   Initialize a accordion with the <code>clearStyle</code> option specified.
       
   323 </dt>
       
   324 <dd>
       
   325 <pre><code>$( ".selector" ).accordion({ clearStyle: true });</code></pre>
       
   326 </dd>
       
   327 
       
   328     
       
   329 <dt>
       
   330   Get or set the <code>clearStyle</code> option, after init.
       
   331 </dt>
       
   332 <dd>
       
   333 <pre><code>//getter
       
   334 var clearStyle = $( ".selector" ).accordion( "option", "clearStyle" );
       
   335 //setter
       
   336 $( ".selector" ).accordion( "option", "clearStyle", true );</code></pre>
       
   337 </dd>
       
   338 
       
   339     </dl>
       
   340   </div>
       
   341 </li>
       
   342 
       
   343 
       
   344 <li class="option" id="option-collapsible">
       
   345   <div class="option-header">
       
   346     <h3 class="option-name"><a href="#option-collapsible">collapsible</a></h3>
       
   347     <dl>
       
   348       <dt class="option-type-label">Type:</dt>
       
   349         <dd class="option-type">Boolean</dd>
       
   350       
       
   351       <dt class="option-default-label">Default:</dt>
       
   352         <dd class="option-default">false</dd>
       
   353       
       
   354     </dl>
       
   355   </div>
       
   356   <div class="option-description">
       
   357     <p>Whether all the sections can be closed at once. Allows collapsing the active section by the triggering event (click is the default).</p>
       
   358   </div>
       
   359   <div class="option-examples">
       
   360     <h4>Code examples</h4>
       
   361     <dl class="option-examples-list">
       
   362     
       
   363 <dt>
       
   364   Initialize a accordion with the <code>collapsible</code> option specified.
       
   365 </dt>
       
   366 <dd>
       
   367 <pre><code>$( ".selector" ).accordion({ collapsible: true });</code></pre>
       
   368 </dd>
       
   369 
       
   370     
       
   371 <dt>
       
   372   Get or set the <code>collapsible</code> option, after init.
       
   373 </dt>
       
   374 <dd>
       
   375 <pre><code>//getter
       
   376 var collapsible = $( ".selector" ).accordion( "option", "collapsible" );
       
   377 //setter
       
   378 $( ".selector" ).accordion( "option", "collapsible", true );</code></pre>
       
   379 </dd>
       
   380 
       
   381     </dl>
       
   382   </div>
       
   383 </li>
       
   384 
       
   385 
       
   386 <li class="option" id="option-event">
       
   387   <div class="option-header">
       
   388     <h3 class="option-name"><a href="#option-event">event</a></h3>
       
   389     <dl>
       
   390       <dt class="option-type-label">Type:</dt>
       
   391         <dd class="option-type">String</dd>
       
   392       
       
   393       <dt class="option-default-label">Default:</dt>
       
   394         <dd class="option-default">'click'</dd>
       
   395       
       
   396     </dl>
       
   397   </div>
       
   398   <div class="option-description">
       
   399     <p>The event on which to trigger the accordion.</p>
       
   400   </div>
       
   401   <div class="option-examples">
       
   402     <h4>Code examples</h4>
       
   403     <dl class="option-examples-list">
       
   404     
       
   405 <dt>
       
   406   Initialize a accordion with the <code>event</code> option specified.
       
   407 </dt>
       
   408 <dd>
       
   409 <pre><code>$( ".selector" ).accordion({ event: 'mouseover' });</code></pre>
       
   410 </dd>
       
   411 
       
   412     
       
   413 <dt>
       
   414   Get or set the <code>event</code> option, after init.
       
   415 </dt>
       
   416 <dd>
       
   417 <pre><code>//getter
       
   418 var event = $( ".selector" ).accordion( "option", "event" );
       
   419 //setter
       
   420 $( ".selector" ).accordion( "option", "event", 'mouseover' );</code></pre>
       
   421 </dd>
       
   422 
       
   423     </dl>
       
   424   </div>
       
   425 </li>
       
   426 
       
   427 
       
   428 <li class="option" id="option-fillSpace">
       
   429   <div class="option-header">
       
   430     <h3 class="option-name"><a href="#option-fillSpace">fillSpace</a></h3>
       
   431     <dl>
       
   432       <dt class="option-type-label">Type:</dt>
       
   433         <dd class="option-type">Boolean</dd>
       
   434       
       
   435       <dt class="option-default-label">Default:</dt>
       
   436         <dd class="option-default">false</dd>
       
   437       
       
   438     </dl>
       
   439   </div>
       
   440   <div class="option-description">
       
   441     <p>If set, the accordion completely fills the height of the parent element. Overrides autoheight.</p>
       
   442   </div>
       
   443   <div class="option-examples">
       
   444     <h4>Code examples</h4>
       
   445     <dl class="option-examples-list">
       
   446     
       
   447 <dt>
       
   448   Initialize a accordion with the <code>fillSpace</code> option specified.
       
   449 </dt>
       
   450 <dd>
       
   451 <pre><code>$( ".selector" ).accordion({ fillSpace: true });</code></pre>
       
   452 </dd>
       
   453 
       
   454     
       
   455 <dt>
       
   456   Get or set the <code>fillSpace</code> option, after init.
       
   457 </dt>
       
   458 <dd>
       
   459 <pre><code>//getter
       
   460 var fillSpace = $( ".selector" ).accordion( "option", "fillSpace" );
       
   461 //setter
       
   462 $( ".selector" ).accordion( "option", "fillSpace", true );</code></pre>
       
   463 </dd>
       
   464 
       
   465     </dl>
       
   466   </div>
       
   467 </li>
       
   468 
       
   469 
       
   470 <li class="option" id="option-header">
       
   471   <div class="option-header">
       
   472     <h3 class="option-name"><a href="#option-header">header</a></h3>
       
   473     <dl>
       
   474       <dt class="option-type-label">Type:</dt>
       
   475         <dd class="option-type">Selector, jQuery</dd>
       
   476       
       
   477       <dt class="option-default-label">Default:</dt>
       
   478         <dd class="option-default">'&gt; li &gt;&nbsp;:first-child,&gt;&nbsp;:not(li):even'</dd>
       
   479       
       
   480     </dl>
       
   481   </div>
       
   482   <div class="option-description">
       
   483     <p>Selector for the header element.</p>
       
   484   </div>
       
   485   <div class="option-examples">
       
   486     <h4>Code examples</h4>
       
   487     <dl class="option-examples-list">
       
   488     
       
   489 <dt>
       
   490   Initialize a accordion with the <code>header</code> option specified.
       
   491 </dt>
       
   492 <dd>
       
   493 <pre><code>$( ".selector" ).accordion({ header: 'h3' });</code></pre>
       
   494 </dd>
       
   495 
       
   496     
       
   497 <dt>
       
   498   Get or set the <code>header</code> option, after init.
       
   499 </dt>
       
   500 <dd>
       
   501 <pre><code>//getter
       
   502 var header = $( ".selector" ).accordion( "option", "header" );
       
   503 //setter
       
   504 $( ".selector" ).accordion( "option", "header", 'h3' );</code></pre>
       
   505 </dd>
       
   506 
       
   507     </dl>
       
   508   </div>
       
   509 </li>
       
   510 
       
   511 
       
   512 <li class="option" id="option-icons">
       
   513   <div class="option-header">
       
   514     <h3 class="option-name"><a href="#option-icons">icons</a></h3>
       
   515     <dl>
       
   516       <dt class="option-type-label">Type:</dt>
       
   517         <dd class="option-type">Object</dd>
       
   518       
       
   519       <dt class="option-default-label">Default:</dt>
       
   520         <dd class="option-default">{ 'header': 'ui-icon-triangle-1-e', 'headerSelected': 'ui-icon-triangle-1-s' }</dd>
       
   521       
       
   522     </dl>
       
   523   </div>
       
   524   <div class="option-description">
       
   525     <p>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 <a href="http://www.themeroller.com" class="external text" title="http://www.themeroller.com">jQuery UI ThemeRoller</a></p>
       
   526   </div>
       
   527   <div class="option-examples">
       
   528     <h4>Code examples</h4>
       
   529     <dl class="option-examples-list">
       
   530     
       
   531 <dt>
       
   532   Initialize a accordion with the <code>icons</code> option specified.
       
   533 </dt>
       
   534 <dd>
       
   535 <pre><code>$( ".selector" ).accordion({ icons: { 'header': 'ui-icon-plus', 'headerSelected': 'ui-icon-minus' } });</code></pre>
       
   536 </dd>
       
   537 
       
   538     
       
   539 <dt>
       
   540   Get or set the <code>icons</code> option, after init.
       
   541 </dt>
       
   542 <dd>
       
   543 <pre><code>//getter
       
   544 var icons = $( ".selector" ).accordion( "option", "icons" );
       
   545 //setter
       
   546 $( ".selector" ).accordion( "option", "icons", { 'header': 'ui-icon-plus', 'headerSelected': 'ui-icon-minus' } );</code></pre>
       
   547 </dd>
       
   548 
       
   549     </dl>
       
   550   </div>
       
   551 </li>
       
   552 
       
   553 
       
   554 <li class="option" id="option-navigation">
       
   555   <div class="option-header">
       
   556     <h3 class="option-name"><a href="#option-navigation">navigation</a></h3>
       
   557     <dl>
       
   558       <dt class="option-type-label">Type:</dt>
       
   559         <dd class="option-type">Boolean</dd>
       
   560       
       
   561       <dt class="option-default-label">Default:</dt>
       
   562         <dd class="option-default">false</dd>
       
   563       
       
   564     </dl>
       
   565   </div>
       
   566   <div class="option-description">
       
   567     <p>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.</p>
       
   568   </div>
       
   569   <div class="option-examples">
       
   570     <h4>Code examples</h4>
       
   571     <dl class="option-examples-list">
       
   572     
       
   573 <dt>
       
   574   Initialize a accordion with the <code>navigation</code> option specified.
       
   575 </dt>
       
   576 <dd>
       
   577 <pre><code>$( ".selector" ).accordion({ navigation: true });</code></pre>
       
   578 </dd>
       
   579 
       
   580     
       
   581 <dt>
       
   582   Get or set the <code>navigation</code> option, after init.
       
   583 </dt>
       
   584 <dd>
       
   585 <pre><code>//getter
       
   586 var navigation = $( ".selector" ).accordion( "option", "navigation" );
       
   587 //setter
       
   588 $( ".selector" ).accordion( "option", "navigation", true );</code></pre>
       
   589 </dd>
       
   590 
       
   591     </dl>
       
   592   </div>
       
   593 </li>
       
   594 
       
   595 
       
   596 <li class="option" id="option-navigationFilter">
       
   597   <div class="option-header">
       
   598     <h3 class="option-name"><a href="#option-navigationFilter">navigationFilter</a></h3>
       
   599     <dl>
       
   600       <dt class="option-type-label">Type:</dt>
       
   601         <dd class="option-type">Function</dd>
       
   602       
       
   603       <dt class="option-default-label">Default:</dt>
       
   604         <dd class="option-default"> </dd>
       
   605       
       
   606     </dl>
       
   607   </div>
       
   608   <div class="option-description">
       
   609     <p>Overwrite the default location.href-matching with your own matcher.</p>
       
   610   </div>
       
   611   <div class="option-examples">
       
   612     <h4>Code examples</h4>
       
   613     <dl class="option-examples-list">
       
   614     
       
   615 <dt>
       
   616   Initialize a accordion with the <code>navigationFilter</code> option specified.
       
   617 </dt>
       
   618 <dd>
       
   619 <pre><code>$( ".selector" ).accordion({ navigationFilter: function(){ ... } });</code></pre>
       
   620 </dd>
       
   621 
       
   622     
       
   623 <dt>
       
   624   Get or set the <code>navigationFilter</code> option, after init.
       
   625 </dt>
       
   626 <dd>
       
   627 <pre><code>//getter
       
   628 var navigationFilter = $( ".selector" ).accordion( "option", "navigationFilter" );
       
   629 //setter
       
   630 $( ".selector" ).accordion( "option", "navigationFilter", function(){ ... } );</code></pre>
       
   631 </dd>
       
   632 
       
   633     </dl>
       
   634   </div>
       
   635 </li>
       
   636 
       
   637     </ul>
       
   638   </div>
       
   639   <div id="events">
       
   640     <h2 class="top-header">Events</h2>
       
   641     <ul class="events-list">
       
   642       
       
   643 <li class="event" id="event-change">
       
   644   <div class="event-header">
       
   645     <h3 class="event-name"><a href="#event-change">change</a></h3>
       
   646     <dl>
       
   647       <dt class="event-type-label">Type:</dt>
       
   648         <dd class="event-type">accordionchange</dd>
       
   649     </dl>
       
   650   </div>
       
   651   <div class="event-description">
       
   652     <p>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.
       
   653 </p>
       
   654 <pre>$('.ui-accordion').bind('accordionchange', function(event, ui) {
       
   655   ui.newHeader // jQuery object, activated header
       
   656   ui.oldHeader // jQuery object, previous header
       
   657   ui.newContent // jQuery object, activated content
       
   658   ui.oldContent // jQuery object, previous content
       
   659 });</pre></p>
       
   660   </div>
       
   661   <div class="event-examples">
       
   662     <h4>Code examples</h4>
       
   663     <dl class="event-examples-list">
       
   664     
       
   665 <dt>
       
   666   Supply a callback function to handle the <code>change</code> event as an init option.
       
   667 </dt>
       
   668 <dd>
       
   669 <pre><code>$( &quot;.selector&quot; ).accordion({
       
   670    change: function(event, ui) { ... }
       
   671 });</code></pre>
       
   672 </dd>
       
   673 
       
   674     
       
   675 <dt>
       
   676   Bind to the <code>change</code> event by type: <code>accordionchange</code>.
       
   677 </dt>
       
   678 <dd>
       
   679 <pre><code>$( &quot;.selector&quot; ).bind( &quot;accordionchange&quot;, function(event, ui) {
       
   680   ...
       
   681 });</code></pre>
       
   682 </dd>
       
   683 
       
   684     </dl>
       
   685   </div>
       
   686 </li>
       
   687 
       
   688 <p>
       
   689 <li class="event" id="event-changestart">
       
   690   <div class="event-header">
       
   691     <h3 class="event-name"><a href="#event-changestart">changestart</a></h3>
       
   692     <dl>
       
   693       <dt class="event-type-label">Type:</dt>
       
   694         <dd class="event-type">accordionchangestart</dd>
       
   695     </dl>
       
   696   </div>
       
   697   <div class="event-description">
       
   698     <p>This event is triggered every time the accordion starts to change.
       
   699 </p>
       
   700 <pre>$('.ui-accordion').bind('accordionchangestart', function(event, ui) {
       
   701   ui.newHeader // jQuery object, activated header
       
   702   ui.oldHeader // jQuery object, previous header
       
   703   ui.newContent // jQuery object, activated content
       
   704   ui.oldContent // jQuery object, previous content
       
   705 });</pre></p>
       
   706   </div>
       
   707   <div class="event-examples">
       
   708     <h4>Code examples</h4>
       
   709     <dl class="event-examples-list">
       
   710     
       
   711 <dt>
       
   712   Supply a callback function to handle the <code>changestart</code> event as an init option.
       
   713 </dt>
       
   714 <dd>
       
   715 <pre><code>$( &quot;.selector&quot; ).accordion({
       
   716    changestart: function(event, ui) { ... }
       
   717 });</code></pre>
       
   718 </dd>
       
   719 
       
   720     
       
   721 <dt>
       
   722   Bind to the <code>changestart</code> event by type: <code>accordionchangestart</code>.
       
   723 </dt>
       
   724 <dd>
       
   725 <pre><code>$( &quot;.selector&quot; ).bind( &quot;accordionchangestart&quot;, function(event, ui) {
       
   726   ...
       
   727 });</code></pre>
       
   728 </dd>
       
   729 
       
   730     </dl>
       
   731   </div>
       
   732 </li>
       
   733 
       
   734     </ul>
       
   735   </div>
       
   736   <div id="methods">
       
   737     <h2 class="top-header">Methods</h2>
       
   738     <ul class="methods-list">
       
   739       
       
   740 <li class="method" id="method-destroy">
       
   741   <div class="method-header">
       
   742     <h3 class="method-name"><a href="#method-destroy">destroy</a></h3>
       
   743     <dl>
       
   744       <dt class="method-signature-label">Signature:</dt>
       
   745         <dd class="method-signature">.accordion( "destroy"
       
   746 
       
   747 
       
   748 
       
   749 
       
   750 
       
   751 
       
   752 
       
   753 )</dd>
       
   754     </dl>
       
   755   </div>
       
   756   <div class="method-description">
       
   757     <p>Remove the accordion functionality completely. This will return the element back to its pre-init state.</p>
       
   758   </div>
       
   759 </li>
       
   760 
       
   761 <p>
       
   762 <li class="method" id="method-disable">
       
   763   <div class="method-header">
       
   764     <h3 class="method-name"><a href="#method-disable">disable</a></h3>
       
   765     <dl>
       
   766       <dt class="method-signature-label">Signature:</dt>
       
   767         <dd class="method-signature">.accordion( "disable"
       
   768 
       
   769 
       
   770 
       
   771 
       
   772 
       
   773 
       
   774 
       
   775 )</dd>
       
   776     </dl>
       
   777   </div>
       
   778   <div class="method-description">
       
   779     <p>Disable the accordion.</p>
       
   780   </div>
       
   781 </li>
       
   782 
       
   783 
       
   784 <li class="method" id="method-enable">
       
   785   <div class="method-header">
       
   786     <h3 class="method-name"><a href="#method-enable">enable</a></h3>
       
   787     <dl>
       
   788       <dt class="method-signature-label">Signature:</dt>
       
   789         <dd class="method-signature">.accordion( "enable"
       
   790 
       
   791 
       
   792 
       
   793 
       
   794 
       
   795 
       
   796 
       
   797 )</dd>
       
   798     </dl>
       
   799   </div>
       
   800   <div class="method-description">
       
   801     <p>Enable the accordion.</p>
       
   802   </div>
       
   803 </li>
       
   804 
       
   805 
       
   806 <li class="method" id="method-option">
       
   807   <div class="method-header">
       
   808     <h3 class="method-name"><a href="#method-option">option</a></h3>
       
   809     <dl>
       
   810       <dt class="method-signature-label">Signature:</dt>
       
   811         <dd class="method-signature">.accordion( "option"
       
   812 
       
   813 , optionName
       
   814 
       
   815 , <span class="optional">[</span>value<span class="optional">] </span>
       
   816 
       
   817 
       
   818 
       
   819 )</dd>
       
   820     </dl>
       
   821   </div>
       
   822   <div class="method-description">
       
   823     <p>Get or set any accordion option. If no value is specified, will act as a getter.</p>
       
   824   </div>
       
   825 </li>
       
   826 
       
   827 
       
   828 <li class="method" id="method-option">
       
   829   <div class="method-header">
       
   830     <h3 class="method-name"><a href="#method-option">option</a></h3>
       
   831     <dl>
       
   832       <dt class="method-signature-label">Signature:</dt>
       
   833         <dd class="method-signature">.accordion( "option"
       
   834 
       
   835 , options
       
   836 
       
   837 
       
   838 
       
   839 
       
   840 
       
   841 )</dd>
       
   842     </dl>
       
   843   </div>
       
   844   <div class="method-description">
       
   845     <p>Set multiple accordion options at once by providing an options object.</p>
       
   846   </div>
       
   847 </li>
       
   848 
       
   849 
       
   850 <li class="method" id="method-widget">
       
   851   <div class="method-header">
       
   852     <h3 class="method-name"><a href="#method-widget">widget</a></h3>
       
   853     <dl>
       
   854       <dt class="method-signature-label">Signature:</dt>
       
   855         <dd class="method-signature">.accordion( "widget"
       
   856 
       
   857 
       
   858 
       
   859 
       
   860 
       
   861 
       
   862 
       
   863 )</dd>
       
   864     </dl>
       
   865   </div>
       
   866   <div class="method-description">
       
   867     <p>Returns the .ui-accordion element.</p>
       
   868   </div>
       
   869 </li>
       
   870 
       
   871 
       
   872 <li class="method" id="method-activate">
       
   873   <div class="method-header">
       
   874     <h3 class="method-name"><a href="#method-activate">activate</a></h3>
       
   875     <dl>
       
   876       <dt class="method-signature-label">Signature:</dt>
       
   877         <dd class="method-signature">.accordion( "activate"
       
   878 
       
   879 , index
       
   880 
       
   881 
       
   882 
       
   883 
       
   884 
       
   885 )</dd>
       
   886     </dl>
       
   887   </div>
       
   888   <div class="method-description">
       
   889     <p>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>).</p>
       
   890   </div>
       
   891 </li>
       
   892 
       
   893 
       
   894 <li class="method" id="method-resize">
       
   895   <div class="method-header">
       
   896     <h3 class="method-name"><a href="#method-resize">resize</a></h3>
       
   897     <dl>
       
   898       <dt class="method-signature-label">Signature:</dt>
       
   899         <dd class="method-signature">.accordion( "resize"
       
   900 
       
   901 
       
   902 
       
   903 
       
   904 
       
   905 
       
   906 
       
   907 )</dd>
       
   908     </dl>
       
   909   </div>
       
   910   <div class="method-description">
       
   911     <p>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.</p>
       
   912   </div>
       
   913 </li>
       
   914 
       
   915     </ul>
       
   916   </div>
       
   917   <div id="theming">
       
   918     <h2 class="top-header">Theming</h2>
       
   919     <p>The jQuery UI Accordion plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain.
       
   920 </p>
       
   921   <p>If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.accordion.css stylesheet that can be modified. These classes are highlighed in bold below.
       
   922 </p>
       
   923     
       
   924   <h3>Sample markup with jQuery UI CSS Framework classes</h3>
       
   925   &lt;div class="<strong>ui-accordion</strong> ui-widget ui-helper-reset"&gt;<br />
       
   926 &nbsp;&nbsp;&lt;h3 class="<strong>ui-accordion-header</strong> ui-helper-reset ui-state-active ui-corner-top"&gt;<br />
       
   927 &nbsp;&nbsp;&nbsp;&nbsp;&lt;span class="ui-icon ui-icon-triangle-1-s"/&gt;<br />
       
   928 &nbsp;&nbsp;&nbsp;&nbsp;&lt;a href="#"&gt;Section 1&lt;/a&gt;<br />
       
   929 &nbsp;&nbsp;&lt;/h3&gt;<br />
       
   930 &nbsp;&nbsp;&lt;div class="<strong>ui-accordion-content</strong> ui-helper-reset ui-widget-content ui-corner-bottom <strong>ui-accordion-content-active</strong>"&gt;<br />
       
   931 &nbsp;&nbsp;&nbsp;&nbsp;Section 1 content<br />
       
   932 &nbsp;&nbsp;&lt;/div&gt;<br />
       
   933 &nbsp;&nbsp;&lt;h3 class="<strong>ui-accordion-header</strong> ui-helper-reset ui-state-default ui-corner-all"&gt;<br />
       
   934 &nbsp;&nbsp;&nbsp;&nbsp;&lt;span class="ui-icon ui-icon-triangle-1-e"/&gt;<br />
       
   935 &nbsp;&nbsp;&nbsp;&nbsp;&lt;a href="#"&gt;Section 2&lt;/a&gt;<br />
       
   936 &nbsp;&nbsp;&lt;/h3&gt;<br />
       
   937 &nbsp;&nbsp;&lt;div class="<strong>ui-accordion-content</strong> ui-helper-reset ui-widget-content ui-corner-bottom"&gt;<br />
       
   938 &nbsp;&nbsp;&nbsp;&nbsp;Section 2 content<br />
       
   939 &nbsp;&nbsp;&lt;/div&gt;<br />
       
   940 &nbsp;&nbsp;&lt;h3 class="<strong>ui-accordion-header</strong> ui-helper-reset ui-state-default ui-corner-all"&gt;<br />
       
   941 &nbsp;&nbsp;&nbsp;&nbsp;&lt;span class="ui-icon ui-icon-triangle-1-e"/&gt;<br />
       
   942 &nbsp;&nbsp;&nbsp;&nbsp;&lt;a href="#"&gt;Section 3&lt;/a&gt;<br />
       
   943 &nbsp;&nbsp;&lt;/h3&gt;<br />
       
   944 &nbsp;&nbsp;&lt;div class="<strong>ui-accordion-content</strong> ui-helper-reset ui-widget-content ui-corner-bottom"&gt;<br />
       
   945 &nbsp;&nbsp;&nbsp;&nbsp;Section 3 content<br />
       
   946 &nbsp;&nbsp;&lt;/div&gt;<br />
       
   947 &lt;/div&gt;<br />
       
   948   <p class="theme-note">
       
   949     <strong>
       
   950       Note: This is a sample of markup generated by the accordion plugin, not markup you should use to create a accordion. The only markup needed for that is <br />&lt;div&gt;<br />
       
   951 &#160;&#160;&#160;&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Section 1&lt;/a&gt;&lt;/h3&gt;<br />
       
   952 &#160;&#160;&#160;&lt;div&gt;<br />
       
   953 &#160;&#160;&#160;&#160;&#160;&#160;Section 1 content<br />
       
   954 &#160;&#160;&#160;&lt;/div&gt;<br />
       
   955 &#160;&#160;&#160;&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Section 2&lt;/a&gt;&lt;/h3&gt;<br />
       
   956 &#160;&#160;&#160;&lt;div&gt;<br />
       
   957 &#160;&#160;&#160;&#160;&#160;&#160;Section 2 content<br />
       
   958 &#160;&#160;&#160;&lt;/div&gt;<br />
       
   959 &#160;&#160;&#160;&lt;h3&gt;&lt;a href=&quot;#&quot;&gt;Section 3&lt;/a&gt;&lt;/h3&gt;<br />
       
   960 &#160;&#160;&#160;&lt;div&gt;<br />
       
   961 &#160;&#160;&#160;&#160;&#160;&#160;Section 3 content<br />
       
   962 &#160;&#160;&#160;&lt;/div&gt;<br />
       
   963 &lt;/div&gt;.
       
   964     </strong>
       
   965   </p>
       
   966 
       
   967   </div>
       
   968 </div>
       
   969 
       
   970 </p><!-- 
       
   971 Pre-expand include size: 36551 bytes
       
   972 Post-expand include size: 61985 bytes
       
   973 Template argument size: 35253 bytes
       
   974 Maximum: 2097152 bytes
       
   975 -->
       
   976 
       
   977 <!-- Saved in parser cache with key jqdocs_docs:pcache:idhash:3773-1!1!0!!en!2 and timestamp 20100421180144 -->