hello,
how can i check if my mobile is "opened" or "closed"? i want to switch the hamburger icon to a close icon if the nav is opened... and i couldn't find out how.
why am i finding 16 results for "hide" in the unminified-js and only 9 in the minified-js.. that makes no sense at all.
maybe comments :joy: :joy:
@Thanood i tried this with this code:
show : function() {
this.trigger('click');
$(".button-collapse").addClass("menuopen");
$("#nav-mobile").addClass("open");
},
hide : function() {
$('#sidenav-overlay').trigger('click');
$(".button-collapse").removeClass("menuopen");
$("#nav-mobile").removeClass("open");
}
but this doesn't work. no class is added.
ok i think now it's working. only one thing which doesn't work:
if i use the hammer.js-extension where the user is able to drag the navi in and out the addClass-Stuff works, but i can't find the trigger where the navi gets dragged out. this is my only error i get.. the classes stay on the button and the nav if i drag the navi out.
ok found everything:
i added my removeClass-Stuff in the "removeMenu();"-Function.
and everwhere it says menuOut = true, i added my addClass-Stuff and vice versa on menuOut = false except where menuOut = false is followed by removeMenu();.
@Thanood can you tell me a bit more about how you hook into that ? I am having the same issue with my hamburger changing. One problem is that you can click anywhere to close the sideNav so my burger has no idea that it was closed. Is there a way to listen to the menuOut status? Thanks in advance for the help.
Sorry, I didn't actually try that yet. :smile:
I can try it tomorrow but now I have to get some sleep.
@stueynet I thought of something like $('#sidenav-overlay').on('click')
i used this manually fixed sidenav.js (written for my needs):
everywhere you see some "addClass("open") / addClass("menuopen")" or removeClass of the same classes i added that manually to get the wished effect.
These events are exactly what I'm looking for. I'd like to submit a feature request for opening/closing (show/hide) events for the sidenav.
@lance13c I created a pull request that adds these events back in July, but it doesn't look like they've had a chance to look at it yet, but I've been keeping it up to date with master. So here's to hoping they get to it soon.
Most helpful comment
@lance13c I created a pull request that adds these events back in July, but it doesn't look like they've had a chance to look at it yet, but I've been keeping it up to date with master. So here's to hoping they get to it soon.