Static
getRetrieve an existing widget by element and ID.
Static
registerIf no actions are supplied, nothing is done.
LisnUsageError If the config is invalid.
Readonly
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 trigger's actions.
Readonly
getReturns the trigger config.
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
reverse"Undo"es all the Actions linked to the trigger.
Readonly
run"Do"es all the Actions linked to the trigger.
Readonly
toggle"Toggle"s all the Actions linked to the trigger.
Readonly
toggleRe-enables the widget if disabled, otherwise disables it.
PressTrigger allows you to run actions when the user presses and holds a pointing device (or their finger) on a target element, and undo those actions when they release their pointing device or lift their finger off.
To use with auto-widgets (HTML API), see registerTrigger for the specification.
target
: A string element specification. See getReferenceElement.prevent-default
: booleanprevent-select
: booleanExample
Add classes
active
andpressed
when the user presses and holds (with mouse, finger or any pointer) the element, remove them when they release the mouse.Example
As above, but using a CSS class instead of data attribute:
Example
Play the animations on the element 1000ms after the first time the user presses on the element it.
Example
Add class
pressed
the first time the user presses on the element, and play the animations on the element while the user is pressing on the element with a delay of 100ms, reverse the animations as soon as the user releases the mouse.Example
When the user presses and holds the next element with class
box
then add classesc1
andc2
to the element (that the trigger is defined on) and enable triggermy-trigger
defined on this same element; undo all of that when they release the mouse (or lift their finger/pointer device) from the reference box element.Example
As above, but using
data-lisn-ref
attribute instead of class selector.