Namespace: toggle

UCASUtilities.toggle

Classes

Toggle

Methods

(static) .create(id, show, hide, hideOnClickAway) → {Toggle}

Creates and registers a toggle, which is used to show or hide elements. A toggle requires two callbacks: one for the show event and one for the hide event.
Parameters:
Name Type Description
id string the unique ID of the toggle element
show function a callback on show
hide function a callback on hide
hideOnClickAway boolean trigger hide when clicking away from the toggle
Source:
Returns:
- a reference to the Toggle
Type
Toggle
Example
UCASUtilities.toggle.create('my-id', function(){console.log('show')}, function(){console.log('hide')}, true)

(static) .destroy(id)

Parameters:
Name Type Description
id string the unique ID of the toggle element
Source:
Example
UCASUtilities.toggle.destroy('my-id')

(static) .hide(id)

Parameters:
Name Type Description
id string the unique ID of the toggle element
Source:
Example
UCASUtilities.toggle.hide('my-id')

(static) .hideOthers(id, contextopt)

Parameters:
Name Type Attributes Default Description
id string the unique ID of the toggle element
context node <optional>
document the ancestor node containing the toggle
Source:
Example
UCASUtilities.toggle.hideOthers('my-id')

(static) .show(id)

Parameters:
Name Type Description
id string the unique ID of the toggle element
Source:
Example
UCASUtilities.toggle.show('my-id')