Methods
(inner) collapse(wrapper, contentElem, toggleElem, labelExpand, labelCollapse, collapsedClass, expandedClass, bpsSelector, isExpandedopt) → {Boolean}
Collapse a collapsible element
Parameters
Name | Type | Attributes | Description |
---|---|---|---|
wrapper |
HTMLElement | The element wrapper |
|
contentElem |
HTMLElement | The element containing the collapsible content. |
|
toggleElem |
HTMLElement | The clickable element used for toggling. |
|
labelExpand |
String | The label used to describe the toggle button when the element is collapsed and it is used expanding. |
|
labelCollapse |
String | The label used to describe the toggle button when the element is expanded and it is used collapsing. |
|
collapsedClass |
String | The label to attach to the wrapper when it is collapsed. |
|
expandedClass |
String | The label to attach to the wrapper when it is expanded. |
|
bpsSelector |
String | A selector for the element to which the active breakpoint data is attached. See htz-parse-bps-state |
|
isExpanded |
Boolean |
<optional> |
Indicates if the collapsible is currently collapsed ( |
Fires:
- module:htz-htz-collapsibles/changeState~collapse#event:htz-collapsibles:collapse-before
- module:htz-htz-collapsibles/changeState~collapse#event:htz-collapsibles:collapse-after
Returns
Returns false
to indicate the element has been collapsed.
- Type
- Boolean
(inner) expand(wrapper, contentElem, toggleElem, labelExpand, labelCollapse, collapsedClass, expandedClass, bpsSelector, isExpandedopt) → {Boolean}
Expand a collapsible element
Parameters
Name | Type | Attributes | Description |
---|---|---|---|
wrapper |
HTMLElement | The element wrapper |
|
contentElem |
HTMLElement | The element containing the collapsible content. |
|
toggleElem |
HTMLElement | The clickable element used for toggling. |
|
labelExpand |
String | The label used to describe the toggle button when the element is collapsed and it is used expanding. |
|
labelCollapse |
String | The label used to describe the toggle button when the element is expanded and it is used collapsing. |
|
collapsedClass |
String | The label to attach to the wrapper when it is collapsed. |
|
expandedClass |
String | The label to attach to the wrapper when it is expanded. |
|
bpsSelector |
String | A selector for the element to which the active breakpoint data is attached. See htz-parse-bps-state |
|
isExpanded |
Boolean |
<optional> |
Indicates if the collapsible is currently collapsed ( |
Fires:
- module:htz-htz-collapsibles/changeState~expand#event:htz-collapsibles:expand-before
- module:htz-htz-collapsibles/changeState~expand#event:htz-collapsibles:expand-after
Returns
Returns true
to indicate the element has been expanded.
- Type
- Boolean
(inner) isCollapsed(elem) → {Boolean}
Check if an element is collapsed
Parameters
Name | Type | Description |
---|---|---|
elem |
HtmlElement | The elemnt to test |
Returns
- Type
- Boolean
(inner) toggle(wrapper, contentElem, toggleElem, labelExpand, labelCollapse, collapsedClass, expandedClass, bpsSelector, isExpandedopt) → {Boolean}
Toggle an element's state between collapsed or expanded
Parameters
Name | Type | Attributes | Description |
---|---|---|---|
wrapper |
HTMLElement | The element wrapping |
|
contentElem |
HTMLElement | The element containing the collapsible content. |
|
toggleElem |
HTMLElement | The clickable element used for toggling. |
|
labelExpand |
String | The label used to describe the toggle button when the element is collapsed and the button is used for expanding. |
|
labelCollapse |
String | The label used to describe the toggle button when the element is expanded and the button is used for collapsing. |
|
collapsedClass |
String | The label to attach to the wrapper when it is collapsed. |
|
expandedClass |
String | The label to attach to the wrapper when it is expanded. |
|
bpsSelector |
String | A selector for the element to which the active breakpoint data is attached. See htz-parse-bps-state |
|
isExpanded |
Boolean |
<optional> |
Indicates if the collapsible is collapsed ( |
Fires:
- module:htz-htz-collapsibles/changeState~expand#event:htz-collapsibles:expand-before
- module:htz-htz-collapsibles/changeState~expand#event:htz-collapsibles:expand-after
- module:htz-htz-collapsibles/changeState~collapse#event:htz-collapsibles:collapse-before
- module:htz-htz-collapsibles/changeState~collapse#event:htz-collapsibles:collapse-after
Returns
The collapsible's state after toggling
(true
if expanded, false
if collapsed).
- Type
- Boolean