wezom-toggler
v1.0.7
Published
Wezom toggler plugin
Downloads
4
Readme
Wezom Toggler plugin
Markup
<div class="js-init" data-toggler="" data-ns="namespace-A">Trigger</div>
<div data-dropdown-target="" data-ns="namespace-A">Target</div>
If you click on trigger - the toggleClass will toggle on target
Scripts
// initial Options
initialOptions = {
mainSelector: '[data-toggler]',
targetSelector: '[data-toggler-target]',
toggleClass: 'is-active',
toggleOnBlur: false,
action: 'toggle',
eventsNamespace: 'wToggler'
}
//init example
let $triggers = $('.js-init[data-toggler]');
$triggers.each((i, trigger) => {
Toggler.init(trigger, {
toggleOnBlur:false
});
});
//custom init example (dropdown)
Toggler.init($('.js-init[data-dropdown]'), {
mainSelector: '[data-dropdown]',
targetSelector: '[data-dropdown-target]',
toggleClass: 'is-open',
toggleOnBlur: true,
action: 'toggle',
eventsNamespace: 'wDropdown'
});