Basic (vertical) accordion component
See test/index.html
for example usage.
$ component install ericgj/accordion
select(panel)
when an accordion panel is selecteddeselect(panel)
when an accordion panel is deselected
Creates a new Accordion
bound to the given DOM element or selector.
It makes the following assumptions about the markup:
-
The given element contains one or more hAtom entries. That is,
div
orarticle
elements matched by.hentry
. -
Each entry has an
.entry-title
element (again following hAtom), which is used as the accordion header. Typically this would be anh3
etc, but could also be aheader
that contains several inline- block elements, etc. -
If you want a
caret
(CSS arrow), for convenience the built-in CSS includes styles for this. Simply include a<span class="caret"></span>
within your.entry-title
element.
The following options are available:
deselect {Boolean}
allows collapse of selected panel (default true)multiselect {Boolean}
allows expansion of more than one panel (default false)
Programmatically select (expand) given panel
Programmatically deselect (collapse) given panel
Deselect all panels
MIT