@three11/accordion
Version:
Front-end Accordion widget using max-height
57 lines (40 loc) • 1.68 kB
Markdown
[](https://github.com/three11/accordion/releases/latest)
[](https://github.com/three11/accordion/issues)
[](https://github.com/three11/accordion/commits/master)
[](https://travis-ci.org/three11/accordion)
[](https://www.npmjs.com/package/@three11/accordion)
[](https://www.npmjs.com/package/@three11/accordion)
[](https://github.com/three11/accordion/)
# Accordion
> Accordion widget using max-height and CSS transitions
## Install
```sh
npm i @three11/accordion
```
or
```sh
yarn add @three11/accordion
```
## Usage
First, `import` the module:
```javascript
import Accordion from '@three11/accordion';
```
Then initialize a new instance of the module:
```javascript
const el = doc.querySelector('[data-accordion]');
const accordion = new Accordion(el, (settings = {}));
```
## Settings
The default settings are:
```javascript
{
headSelector: '[data-title]', // Selector for the head element
bodySelector: '[data-content]', // Selector for the body element
hiddenClass: 'is--hidden', // Hidden class name
activeClass: 'is--active' // Active class name
}
```
## License
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007