Skip to main content
Figuration v3 Preview Available!
Widgets

Bring interactivity to your site with a selection of jQuery widgets (plugins) all built with accessibility and usability in mind.

Accordion accordion.js

Accordion extends upon the Collapse widget to associate multiple collapse items in the same container.

Widget Dependencies

Accordion requires the following:

Contents

Example

A simple accordion.

Collapse Toggle #1

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non nisi ipsum. Quisque feugiat, arcu in pulvinar varius; risus odio interdum diam; a hendrerit urna sem vitae enim. Aenean fermentum iaculis nibh sodales consectetur.

Collapse Toggle #2

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non nisi ipsum. Quisque feugiat, arcu in pulvinar varius; risus odio interdum diam; a hendrerit urna sem vitae enim. Aenean fermentum iaculis nibh sodales consectetur.

Collapse Toggle #3

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non nisi ipsum. Quisque feugiat, arcu in pulvinar varius; risus odio interdum diam; a hendrerit urna sem vitae enim. Aenean fermentum iaculis nibh sodales consectetur.
<div data-cfw="accordion">
    <h4><a href="#" data-cfw="collapse" data-cfw-collapse-toggle="accordion0">Collapse Toggle #1</a></h4>
    <div class="collapse" data-cfw-collapse-target="accordion0">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non nisi ipsum. Quisque feugiat, arcu in pulvinar varius; risus odio interdum diam; a hendrerit urna sem vitae enim. Aenean fermentum iaculis nibh sodales consectetur.
    </div>
    <h4><a href="#" data-cfw="collapse" data-cfw-collapse-toggle="accordion1">Collapse Toggle #2</a></h4>
    <div class="collapse" data-cfw-collapse-target="accordion1">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non nisi ipsum. Quisque feugiat, arcu in pulvinar varius; risus odio interdum diam; a hendrerit urna sem vitae enim. Aenean fermentum iaculis nibh sodales consectetur.
    </div>
    <h4><a href="#" data-cfw="collapse" data-cfw-collapse-toggle="accordion2">Collapse Toggle #3</a></h4>
    <div class="collapse" data-cfw-collapse-target="accordion2">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non nisi ipsum. Quisque feugiat, arcu in pulvinar varius; risus odio interdum diam; a hendrerit urna sem vitae enim. Aenean fermentum iaculis nibh sodales consectetur.
    </div>
</div>

Usage

To set up an accordion, all collapse items to be associated must be contained within the same ancestor element that is designated the accordion conatiner.

Via Data Attributes

Add data-cfw="accordion" to the ancestor element that contains all the collapse items to be associated.

Via JavaScript

Call the accordion via JavaScript:

$('#myAccordion').CFW_Accordion();

Methods

.CFW_Accordion()

Activates the an accordion element.

$('#myAccordion').CFW_Accordion();

Events

Event callbacks happen on the accordion element.

You can also get the collapse events as indicated in the Collapse widget due to event bubbling.

Event Type Description
init.cfw.accordion This event fires after the accordion item is initialized.