easy-toggle-state
easy-toggle-state copied to clipboard
data-toggle-target-parent="" doesnt work with data-toggle-group=""?
I'm trying to setup a menu navigation so each sub nav opens and closes the other however, i also want the parent a tag an active class added as well.
<li><a href="#">Button outer</a><button type="button" class="main-btn" data-toggle-class data-toggle-escape data-toggle-target-next=".sub-menu" data-toggle-group="main-nav" title="Sub Navigation">Button for sub</button></li>
So i set it up like this...
<li><a href="#">Button outer</a><button type="button" class="main-btn" data-toggle-class data-toggle-escape data-toggle-target-next=".sub-menu" data-toggle-group="main-nav" data-toggle-target-parent="a" title="Sub Navigation">Button for sub</button></li>
This works by adding the active class to the a
above but now ignores the sub menu group.
Shouldn't these work together?
Hi @unijez ! Sorry for the delay.
Could you send a link with the use case, please?
Sorry the site is on a private network but this is the html of once you clicked the button.
Active is added to the button and sub menu, which is correct, but need it adding to either the immediate parent a
or li
tag, is that possible?
<ul class="category-menu flex-c">
<li id="menu-item-12140" class="menu-item"><a href="#">Digital Projects</a></li>
<li id="menu-item-12141" class="menu-item menu-item-has-children"><a href="#">Test page for testing.</a><button type="button" class="main-btn mobile-arrow-btn is-active" data-toggle-class="" data-toggle-escape="" data-toggle-target-next=".sub-menu" data-toggle-group="main-nav" title="Sub Navigation">
</button>
<ul class="sub-menu is-active">
<li id="menu-item-12143" class="menu-item"><a href="#">Unde eum in velit qui aut sit</a></li>
</ul>
</li>
<li id="menu-item-12142" class="menu-item"><a href="#">Unde eum in velit qui aut sit</a></li>
</ul>