Rico Basic Accordion

Base Library:

Overview

This example illustrates how to use the Rico.Accordion behavior to transform a set of divs into a first class accordion component.

Rico.Accordion is actually a very simple component built off of Rico behaviors and effects. It adds the necessary event handlers on the respective divs to handle the visual aspects of expanding, collapsing and hovering.
HTML Code

The example HTML structure is an outer div that holds all of the panels. Then, each panel is just a couple of DIVs (one for the header and one for the content) wrapped in an outer DIV. The id attribute is only required on the outer div.
 <div id="accordionID">
     <div id="Panel1">
       <div id="Header1">
         Overview
        </div>
        <div id="Content1">
         ... content text ...
        </div>
     </div>
  </div>
  
Rico Code

To attach the accordion behavior to the accordion container div, construct a Rico.Accordion object and pass the id of the outer accordion div to it. This is a bit different than the previous versions.
    new Rico.Accordion( 'accordionID', {panelHeight:200} );
    
There are many other configuration parameters that can be specified to modify various visual aspects of the accordion. The panelHeight is the attribute that is most commonly overridden.
Important Note

The accordion is very flexible. However, you do have to make sure the header and content elements are structured properly.