@mangoweb/toggler
v0.0.6
Published
Toggles class based on data attributes
Downloads
3
Keywords
Readme
Toggler
The manGoweb Toggler component. Toggles class on target element.
Installation
$ npm install @mangoweb/toggler @mangoweb/scripts-base
This is a @mangoweb/scripts-base
component.
Usage
In your template:
<script>
window.initComponents = (window.initComponents || []).push({
name: 'Toggler',
place: 'body'
})
</script>
Use by adding following attributes to HTML element with 'toggler' class:
- data-target - target selector
- data-class-name - class to toggle
- data-remove-others - remove toggle class from elements matching this selector
- data-prevent-default - prevent default event behaviour