Change active by default behaviour and data-toggle-trigger-off improvement
Change active by default behaviour
The attribute data-toggle-is-active
, used to specify a trigger element and its targets toggled as default, was initialy thought when using only one class to toggle. This in mind, the behaviour was adding the class instead of toggling it on script execution.
Now that we are able to add as many classes as we want, on trigger, target, or both, this behaviour doesn't make sence anymore, and even brings problems.
Responding to #91, it is now fix: using this attribute to set a trigger and its targets as active by default will toggle them once on initialization as a consequence.
data-toggle-trigger-off improvement
The behaviour of this attribute is simple: when you toggle a trigger and its target, the script check if there are elements with data-toggle-trigger-off
attribute inside this target element, and if so, it adds a listener on those to toggle the trigger off on click.
The problem is that you can have some problems when you have a target element inside another one, both related to different triggers. In this case, it should be better to specify which "trigger-off" elements are related to which target element.
It is now possible: You can usually leave this attribute without a value, but if you need to specify the related target element, set the value to a CSS selector matching that target element.
Happy toggling 🖖