ul
에서 'show'클래스를 토글하려고하므로 메뉴가 표시되거나 숨겨 지지만 내 JQuery가 좋지 않아 작동하지 않을 수 있습니다.요소를 숨길 때 클릭 요소를 숨기기
<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 매우 좋은 문서가 있습니다 https://api.jquery.com/category/selectors/ –
당신이 바인딩하려고하는 클릭 기능에 관해서 혼란 스러워요. – Learning2Code
@ Learning2Code 그가'div'에 바인딩하는 것처럼 보입니다. –