View on GitHub

Bootstrap Accordion

An easy way to generate bootstrap accordions

Download this project as a .zip file Download this project as a tar.gz file

Supposing the following examples all use this panel object for the first parameter. (Bootstrap Accordion requires Jquery)

var panels = [{
    data: {
        title: 'Collapse Title 1',
        body: 'Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid.'
    }
},{
    data: {
        title: 'Collapse Title 2',
        body: '3 wolf moon officia aute, non cupidatat skateboard dolor brunch.'
    }
},{
    data: {
        title: 'Collapse Title 3',
        body: 'Food truck quinoa nesciunt laborum eiusmod.'
    },
    options: {
        collapse: true
    }
}];
                    
The Easiest & Simplest Call
$('#accordion').accordion(panels);
Controling Maximum Number of Open Panels
$('#accordion').accordion(panels, {maxOpen: 2});
Setting Default Options for Collapses
$('#accordion').accordion(panels, {collapseDefaults: {style: Collapse.STYLE_PRIMARY}});
Collapse
You can also set options for individual collapse. You can find more details in Bootstrap Collapse.