I'm trying to toggle the class 'show' on the ul so that it shows/hides the menu but my JQuery is not very good and I can't seem to get it to work
<nav>
<ul class="show">
<li><a href="#sec01">about us</a></li>
<li><a href="#sec02">how it works</a></li>
<li><a href="#sec03">comments</a></li>
</ul>
</nav>
<div class="hamburger"></div>
nav {position:relative; z-index:999; display:flex; height:70px; width:100%; background:none; @include centerer; font-weight:bold;font-family: 'Roboto', sans-serif;
@include small{background:#DADADA;}
@include xs {background:#DADADA;;}}
nav ul {display:flex; list-style:none; flex-direction:row;
@include small{margin-top:160px;flex-direction:column;}
@include xs{flex-direction:column;}}
nav li { padding:20px; text-transform: uppercase;
@include small{background:#fff; color:#000}
@include xs{background:#fff; color:#000;}}
nav li:hover a {border-bottom:2px solid #ff0000;}
nav a,nav a:visited { color:#fff;text-decoration: none;}
nav a:hover,nav a:active {color:#fff; text-decoration: none; ; }
.show{
visibility:hidden;
}
.hamburger{position:absolute; z-index:999;top:10px; right:10px; height:50px; width:70px; background:#000;
https://jsfiddle.net/hsaw3frL/
$(document).ready(function(){
$( ".hamburger" ).click(function() {
$('ul' ).toggleClass( "show" );
});
});
.c-hamburger. jquery has very nice documentation api.jquery.com/category/selectorsdiv..hamburgernotc-hamburger, and change$('this')to$('ul')... which, after both your question and Caelan's answer were edited, both now do. Your question now asks "what's wrong with this" about code that is correct, making the question moot. You should either restore your bad code in the question, since that was the problem, or delete the question.