Skip to content

Instantly share code, notes, and snippets.

@herrkessler
Last active April 25, 2016 13:47
Show Gist options
  • Save herrkessler/d20d1ed182ffb79c861142c39692c9c7 to your computer and use it in GitHub Desktop.
Save herrkessler/d20d1ed182ffb79c861142c39692c9c7 to your computer and use it in GitHub Desktop.
hamburger icon
a(href="#").js-mobile-menu#menu-icon
span
span
span
$(document).ready(function() {
var navLink = $('#menu-icon'),
menu = $('#menu');
navLink.on('click', function() {
menu.toggleClass('active');
$(this).toggleClass('active');
$('body').toggleClass('menu-active');
});
});
#menu-icon {
display: none;
cursor: pointer;
@include size(30px);
@include media("<=phone") {
display: block;
}
span {
@include size(100% 2px);
transition: all 0.3s ease-out;
display: block;
margin-bottom: 4px;
background: white;
}
&.black {
span {
background: black;
}
}
&.active {
span {
&:first-child {
transform: translateY(6px) rotate(-45deg);
}
&:nth-child(2) {
opacity: 0;
}
&:last-child {
transform: translateY(-6px) rotate(45deg);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment