Rico
Rico Nested Accordions
Note that this example defaults to opening the second panel of the accordion.
This is done by setting options.selectedIndex=1.
Overview
This example illustrates how to use the Rico.Accordion behavior to transform a set of
divs into a first class accordion component.
The Rico.Accordion behavior makes use of the Effect.AccordionSize which is an effect that simultaneously
grows the height of one element while shrinking the height of another. The Rico.Accordion behavior adds
the necessary event handlers on the respective divs to handle the visual aspects of expanding, collapsing
and hovering.
More Info (nested accordion)
Overview of ContentTransition base component
The Accordion now derives from a base component that applies and manages
behaviors and effects. The effects can be defined at the extended class.
This approach results in a very flexible way of managing
Alternative HTML
Since the accordion does not parse the html, it can be constructed much looser
than in previous versions. The base ContentTransition can be used to quicly build
components such as tabs, master details, and many application specific behaviors.
We will be providing examples of building your own soon.
Alternative effects
We will be discussing alternative transition effects here.
Should be interesting.
Rico Code
To attach the accordion behavior to the accordion container div, construct a Rico.Accordion
object and pass the panel titles and contents to it. This is a bit different than the previous version,
but allows a lot more flexibilitiy. With the new Prototype Selector class it is still very easy.
new Rico.Accordion( $$('div.panelheader'), $$('div.panelContent') );
-or-
new Rico.Accordion( $$('div.panelheader'), $$('div.panelContent'),
{panelHeight:200,
hoverClass: 'mdHover',
selectedClass: 'mdSelected'}} );
The second example specifies the height of the accordion panels and the css classes that can be associated
with the accordion behaviors.
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 now and can handle scrollbars on firefox through the use of some new features in Rico.
However, you do have to make sure the header and content elements passed in to the Accordion constructor have the same
elements and match up in the order they are passed. The new Accordion requires far less html attributes than Rico's
previous versions.