jsSimplyAccordion
is a library that implement a simply accordion using ES6.
# bash
npm i js_simply_accordion
const jsAccordion = require("jsAccordion");
// or
import { jsAccordion } from 'jsAccordion';
- accordionData: [{section: string, content: string}]
- options: {entryClass: string} default class '.jsAccordion'
import { jsAccordion } from 'jsAccordion';
import 'jsAccordion/dist/accordion.css';
const accordionData = [
{section: 'My section 1', content: 'My content 1'},
{section: 'My section 2', content: 'My content 2'}
]
const options = {entryClass: '.myEntryClass'}
const accordion = new Accordion(accordionData, options);
- toggle
Toggle a section by section index
import { jsAccordion } from 'jsAccordion';
import 'jsAccordion/dist/accordion.css';
const accordionData = [
{section: 'My section 1', content: 'My content 1'},
{section: 'My section 2', content: 'My content 2'}
]
const accordion = new Accordion(AccordionData);
accordion.toggle(0);
Clone project on github
npm i
npm run build
npm run test
Make changes and create a merge request.