I'm trying to make a responsive navigation:
<header>
<nav>
<ul class="navigation">
<li>
<a href="#">asd</a>
</li>
<li>
<a href="#">asd</a>
</li>
<li>
<a href="#">asd</a>
</li>
<button type="button" id="showmenu"> << </button>
</ul>
</nav>
</header>
Can't use toggle for jquery since the button also disappers, so i tried another way, however the else statement is not executing
$(document).ready(function() {
if(menu=1) {
$('#showmenu').click(function(){
$('nav ul li').hide()
$('nav ul').css('width', '3%');
menu = 2;
});
}
else {
$('#showmenu').click(function() {
$('nav ul ').show();
$('nav ul').css('width', '100%');
menu = 1;
});
}
});
It's an inline navigation sliding to the left. I've seen a bunch of other example, but not a single one where the button hiding the menu is in the navigation. Got any suggestions on how to make this work? Used toggle before that, but the else statement still wouldnt execute. Here 's a JS fiddle: http://jsfiddle.net/qEtgR/7/
Edit: == operator doesn't change a thing, else statement still does not execute, neither does stating a global var menu.