Option name | Type | Description |
---|---|---|
selector | domelement_or_jqueryobject | The element that wraps the accordion contents, containing pairs of elements with classes 'js-header'/'header' and 'js-content/content' |
options | object | Object contianing required options for this accordion |
NATION.Utils
NATION.EventDispatcher
NATION.VerticalScrollbar if scrollbars required
Either NATION.Animation or jQuery
A basic accordion with optional scrollbar support
Header/content pairs are identified by using the class 'js-header' or 'header' for the clickable titles, and 'js-content' or 'content' for the expandable content areas. These are generally expected to sit next to each other as siblings
Both the header element and the content element will have class 'active' added to them when they are open. This allows for style changes to open panels/headers via CSS
Event that fires when a panel has finished opening
Event that fires when a panel has finished closing
Event that fires when a header element has been clicked
Event that fires each frame of an open/close animation
Returns the zero-indexed ID of the currently open panel. Returns -1 if no panel is currently open
Returns the total number of clickable headers
Option name | Type | Description |
---|---|---|
index | number | The zero-indexed ID of the panel to open |
immediate | boolean | If set to true, the panel will open without animation |
Open a panel by it's zero-indexed ID
Option name | Type | Description |
---|---|---|
index | number | The zero-indexed ID of the panel to close |
immediate | boolean | If set to true, the panel will close without animation |
Close a panel by it's zero-indexed ID
Option name | Type | Description |
---|---|---|
reopenPanel | boolean | Keep open, or re-open, the panel that was last open when the disable method was called |
Re-enable accordion functionality. This will close all panels, except when reopenPanel is set to true, which will keep the previously open panel open.
Disable all accordion functionality on the content. This opens all panels to their full height, and ignores clicks on header
Option name | Type | Description |
---|---|---|
The | eigh | new maximum height, in pixels |
Change the maximum possible height of a panel
Re-initialise the accordion. Useful if the content of the accordion
has been dynamically changed
Disable, remove all listeners, and kill off this instance of the class. Permanent!