Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data-toggle-target-parent="" doesnt work with data-toggle-group=""? #118

Open
unijez opened this issue Jan 5, 2022 · 2 comments
Open

data-toggle-target-parent="" doesnt work with data-toggle-group=""? #118

unijez opened this issue Jan 5, 2022 · 2 comments

Comments

@unijez
Copy link

unijez commented Jan 5, 2022

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?

@Twikito
Copy link
Owner

Twikito commented Jan 28, 2022

Hi @unijez !
Sorry for the delay.

Could you send a link with the use case, please?

@unijez
Copy link
Author

unijez commented Jan 31, 2022

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants