Static
getRetrieve an existing widget by element and ID.
Static
registerOptional
config: AutoHideConfigReadonly
destroyUndoes all modifications to the element and returns it to its original state.
You will need to recreate it if you want to enable its functionality again.
Readonly
disableDisables the functionality of the widget. What this means is specific to each widget.
Readonly
enableRe-enables the functionality of the widget. What this means is specific to each widget.
Readonly
getReturns the element passed to the widget constructor.
Readonly
isReturns true if the widget is destroyed.
Readonly
isReturns true if the widget is currently disabled.
Readonly
onThe given handler will be called when the widget is destroyed.
Readonly
onThe given handler will be called when the widget is disabled.
Readonly
onThe given handler will be called when the widget is enabled.
Readonly
toggleRe-enables the widget if disabled, otherwise disables it.
Configures the given element as an AutoHide widget.
The AutoHide widget automatically hides (and optionally removes) the given element, or children of it that match a given selector, after a certain delay.
It executes these actions every time the matching element(s) have a change of attribute or appear (are inserted) into the DOM.
To use with auto-widgets (HTML API) (see settings.autoWidgets), the following CSS classes or data attributes are recognized:
lisn-auto-hide
class ordata-lisn-auto-hide
attributelisn-auto-remove
class ordata-lisn-auto-remove
attribute (enables AutoHideConfig.remove)NOTE: This widget supports multiple instances per element, you can specify multiple widget configurations, separated with ";".
See below examples for what values you can use set for the data attributes in order to modify the configuration of the automatically created widget.
Example
This will automatically hide (with class
lisn-hide
) the element 3 seconds (default delay) after it is inserted into the DOM or after it gets any attributes changed on it (for example that might show it again).Example
This will automatically hide and then remove the element 3 seconds (default delay) after it is inserted into the DOM.
Example
This will automatically
p
elements with classmessage
2 seconds after they are inserted or changedp
elements with classwarning
5 seconds after they are inserted or changed; and it will save that particular AutoHide widget with IDmyID
so that it can be looked up using AutoHide.getp
elements with classdisposable
3 seconds (default delay) after they are inserted or changed