Skip to content

Instantly share code, notes, and snippets.

@f4rr3ll1990
Created June 24, 2017 21:48
Show Gist options
  • Save f4rr3ll1990/787dfd87d3d6c55f4c6b5ac19d860781 to your computer and use it in GitHub Desktop.
Save f4rr3ll1990/787dfd87d3d6c55f4c6b5ac19d860781 to your computer and use it in GitHub Desktop.
Mobile Menu Toggle Button | http://codepen.io/agragregra/pen/bEbbmZ
<!-- HTML -->
<a href="#" class="toggle-mnu hidden-lg"><span></span></a>
<!-- CSS -->
body {
background-color: #333;
}
.toggle-mnu {
display: block;
width: 28px;
height: 28px;
margin-top: 14px;
}
.toggle-mnu span:after, .toggle-mnu span:before {
content: "";
position: absolute;
left: 0;
top: 9px;
}
.toggle-mnu span:after {
top: 18px;
}
.toggle-mnu span {
position: relative;
display: block;
}
.toggle-mnu span, .toggle-mnu span:after, .toggle-mnu span:before {
width: 100%;
height: 2px;
background-color: #fff;
transition: all 0.3s;
backface-visibility: hidden;
border-radius: 2px;
}
.toggle-mnu.on span {
background-color: transparent;
}
.toggle-mnu.on span:before {
transform: rotate(45deg) translate(-1px, 0px);
}
.toggle-mnu.on span:after {
transform: rotate(-45deg) translate(6px, -7px);
}
<!-- jQuery -->
$(".toggle-mnu").click(function() {
$(this).toggleClass("on");
$(".main-mnu").slideToggle();
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment