Reveals and hides elements on the page via a toggle. Expandable elements are initially hidden.
- Source:
Properties:
Name | Type | Description |
---|---|---|
expandToggleSelector |
String | selector for all expandable click toggles |
expandedFlag |
String | css class to add once an element is expanded |
scrollParentSelector |
String | default scroll target to body element |
Example
<button data-expand="#regionExpand" aria-expaneded="false">Click to reveal element below</button>
<div class="is-expandable">Initially hidden content</div>
Methods
(inner) init()
- Source:
Binds click events to any data-expand="[selector]"
elements on the page.
(inner) setScrollPosition($toggle, $childe)
- Source:
Adjusts scroll position so expanded element is in view
Parameters:
Name | Type | Description |
---|---|---|
$toggle |
Element | DOM reference to the clicked toggle element |
$childe |
Element | DOM reference to the exapanding element |