js_simply_accordion

1.0.3 • Public • Published

jsSimplyAccordion

License: MIT

jsSimplyAccordion is a library that implement a simply accordion using ES6.

Install

NPM

# bash
npm i js_simply_accordion
const jsAccordion = require("jsAccordion"); 
// or
import { jsAccordion } from 'jsAccordion';

Use

Params

  • 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);

Methods

  • toggle

jsAccordion.toggle

Toggle a section by section index

Example

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);

Source Code

accordion()

Contribution Notes

Clone project on github

Install libraries

npm i

Build

npm run build

Tests

npm run test

Open Pull Request

Make changes and create a merge request.

Readme

Keywords

Package Sidebar

Install

npm i js_simply_accordion

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

15.4 kB

Total Files

10

Last publish

Collaborators

  • jazhann