Getting Started
The accordion's markup is based on definition list. The goal is to keep the markup simple to maintain. The application will fill in the necessary attributes.
A trigger element (usually an anchor, button or H1-H6) is required inside
the <dt> element. The content to be revealed
should be wrapped inside
the <dd> element.
<dl class="jsa"> <dt><a href="#">Title One</a></dt> <dd>Lorem ipsum dolor sit.</dd> <dt><a href="#">Title Two</a></dt> <dd>Lorem ipsum dolor sit.</dd> <dt><a href="#">Title Three</a></dt> <dd>Lorem ipsum dolor sit.</dd> </dl>
To instantiate the accordion, you need to include the JavaScript file and create a new instance of the accordion class.
The <dl> element should have the class jsa applied to it.
For multiple instances of the accordion on the same page, you need to declare a unique
selector to the instance. For example, #jsa-menu, .jsa-accordion2
class on each <dl> element.
import { jsa } from '@homiehomes/jsa'; new jsa(); // Additional accordion new jsa( { dl: '#jsa-menu', } );