Accordion widget using max-height and CSS transitions
npm i @three11/accordionor
yarn add @three11/accordionFirst, import the module:
import Accordion from '@three11/accordion';Then initialize a new instance of the module:
const el = doc.querySelector('[data-accordion]');
const accordion = new Accordion(el, (settings = {}));The default settings are:
{
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
}GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007