ToggleClass
To toggle a class on click or tap use the data-toggle-class
helper.
Usage:
Add the following data attributes to your button or link.
data-toggle-class="is-visible"
- The selector you'd like to be applied to the toggled element.
data-target=".some-div"
- The selector of the element you'd like toggled. This is where the class will be applied.
Note:
The button or link you are using will have the class is-active
applied to it when the target element is toggled 'on'.
Requires:
dist/js/toggle-class-es6.js
Example:
<button data-toggle-class="is-visible" data-target=".some-div">Click Me</button>