Accordion

Accordion

new Accordion(el, options, key) → {Accordion}

Source:
Properties:
Name Type Description
options.closeOthers Boolean

only allow one accordion to be open at a time

options.activeIndex Number

set one of the accordions to be open

This class handles accordions...

Example
js: 

new Accordion(document.getElementById('accordion'), { 
	closeOthers: true 
}, 'ui-key').mount()

Required markup:

<ul data-ui="Accordion" data-ui-options='{"close-others": true, "active-index": 1}' data-ui-key="downloads-accordion">
		<li>
			<a href="#bt1" data-accordion-button>Datasheets</a>
			<ul class="list-reset hidden" data-accordion-dropdown id="bt1">...</ul>
		</li>
		<li>
			<a href="#bt2" data-accordion-button>Datasheets</a>
			<ul class="list-reset hidden" data-accordion-dropdown id="bt2">...</ul>
		</li>
		<li>
			<a href="#bt3" data-accordion-button>Datasheets</a>
			<ul class="list-reset hidden" data-accordion-dropdown id="bt3">...</ul>
		</li>
	</ul>
Parameters:
Name Type Description
el HTMLElement

node to bind to

options Object

options

key String

key name

Returns:
Type
Accordion

Methods

(static) close(index) → {void}

Source:

Close the accordion

Parameters:
Name Type Description
index Number

: index of the accordion to close

Returns:
Type
void

(static) mount() → {void}

Source:

Add the events

Returns:
Type
void

(static) onClick(e, elm) → {void}

Source:

the click event...

Parameters:
Name Type Description
e Object

: the event object

elm HTMLElement

: the node clicked

Returns:
Type
void

(static) open(index) → {void}

Source:

Open the accordion

Parameters:
Name Type Description
index Number

: index of the accordion to open

Returns:
Type
void

(static) unmount() → {void}

Source:

remove the events

Returns:
Type
void