-
Notifications
You must be signed in to change notification settings - Fork 35
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
Help: Toggle Class From Another Element? #13
Comments
Thanks for your question. Did you try adding By the way, if your close button is inside your navigation panel, you only need to add Hope that will help you. |
Thank you for the suggestion, the above buttons appear separately. Unfortunately your suggestion doesn't work, because its a div that wraps everything, so clicking anywhere obviously turns it on.
Ideally i only want the one above to function when it has an |
Ok, is this what you need ? https://codepen.io/Twikito/pen/VdJVop |
Yes! Perfect, how does the day area know to close it again? |
It's a CSS pseudo element inside the trigger button 😉 |
Amazing, thank you :) |
Is it possible to toggle a class from another element, for example a slide navigation panel controlled via burger button. Once open close from another div.
Currently i have 2 buttons, the first opens the panel, adding active class, the second appears within that panel to close it, both are below...
Open Panel...
<button type="button" class="site-header__mobile-button lines-nav main-btn " data-toggle-class data-toggle-escape data-toggle-target=" .whole-page, .navigation-panel_holder, .navigation-panel_main, body" title="Navigation">Open Menu</button>
Once open close panel...
<button type="button" class="navigation-panel_main-button main-btn " data-toggle-class data-toggle-escape data-toggle-target=" .whole-page, .navigation-panel_holder, .navigation-panel_main, body" title="Navigation">Close Menu</button>
Both these work fine, but would it be possible to add another class, i'e an overlay outside of the panel so when you click anywhere else it toggles the above?
So a div click toggle class the above, the i try and set this up it seems to do funny things.
The text was updated successfully, but these errors were encountered: