Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ericgj/accordion
Basic (vertical) accordion component
https://github.com/ericgj/accordion
Last synced: 9 days ago
JSON representation
Basic (vertical) accordion component
- Host: GitHub
- URL: https://github.com/ericgj/accordion
- Owner: ericgj
- Created: 2013-04-29T15:18:12.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-01T21:40:52.000Z (almost 11 years ago)
- Last Synced: 2024-11-15T12:27:53.650Z (2 months ago)
- Language: JavaScript
- Size: 195 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# Accordion
Basic (vertical) accordion component
See `test/index.html` for example usage.
## Installation$ component install ericgj/accordion
## Events
- `select(panel)` when an accordion panel is selected
- `deselect(panel)` when an accordion panel is deselected## API
### Accordion(el, options)Creates a new `Accordion` bound to the given DOM element or selector.
It makes the following assumptions about the markup:
1. The given element contains one or more [hAtom][hatom] entries. That is,
`div` or `article` elements matched by `.hentry`.2. Each entry has an `.entry-title` element (again following hAtom),
which is used as the accordion header. Typically this would be an
`h3` etc, but could also be a `header` that contains several inline-
block elements, etc.3. If you want a `caret` (CSS arrow), for convenience the built-in CSS
includes styles for this. Simply include a ``
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)### Accordion#select(panel)
Programmatically select (expand) given panel
### Accordion#deselect(panel)
Programmatically deselect (collapse) given panel
### Accordion#deselectAll
Deselect all panels
## License
MIT
[hatom]: http://microformats.org/wiki/hatom "hAtom Microformat Spec"