SActivateFeature
This feature allows you to activate some elements depending on triggers like click
, mouseover
, mouseout
, anchor
, etc...
To be explicit, you can apply this feature on a link tag with the href attribute #something
, and on click,
the DOM element that has the id "something" will get the "active" class applied.
Preview
Simple click activation
Loading code example. Please wait...
Grouping
Loading code example. Please wait...
Toggle mode
Loading code example. Please wait...
Features
-
Take the
href
attribute as target -
Allows to
group
some element for tabs behavior, etc... -
Support the
toggle
mode -
Support the
history
mode -
Allows you to
save state
torestore them
on page load -
Available trigger:
click
,mouseover
,mouseout
,anchor
and more to come -
Expand the HTMLTemplateElement that stands as direct child of the dom feature itself AND of the targets
Import
Install
Events
-
s-activate.activate
Dispatched from each targets when they are activated
-
s-activate.unactivate
Dispatched from each targets when they are unactivated
Interface
-
hrefString
Specify the target element(s) to activate/unactivate
-
groupString
Specify a group id for your element. This is used for things like tabs, etc...
-
togglefalseBoolean
Specify if you want to be able to click on the same element to activate/unactivate it.
-
historyfalseBoolean
Specify if you want to store and react to history hash changes
-
activefalseBoolean
Specify the initial state of your element
-
activeClassactiveString
Specify the class applied on target(s) when active. Default is "active"
-
activeAttributeactiveString
Specify the attribute name applied on target(s) when active.
-
saveStatefalseBoolean
Specify if you want to save state in localStorage to restore it on page reload, etc...
-
activateTimeout0Number
Specify a timeout before actiavting the target(s)
-
unactivateTimeout0Number
Specify a timeout before unactivate the target(s)
-
triggererString
Specify an element selector that will be used as the triggerer instead of this current element
-
trigger["click"]
- click
- mouseover
- mouseenter
- mouseout
- mouseleave
- anchor
Array<String>Specify what trigger an activate/unactivate action. Can be "click", "mouseover", "mouseout" ,"anchor", "event:%eventName" "and/or" "cookie:%cookieName.%optionalDotPath". When using the "event:", the listener will be the node itself by default but you can specify the "document" like so "event:%eventName:document". When using "cookie", you can negate the assertion like so "!cookie:myCookie.myValue"
-
unactivateOnArray<String>
Specify some event(s) catched on the body tag that will unactivate the target(s)