Skip to content

Instantly share code, notes, and snippets.

@maxxscho
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxxscho/b983984867df49cca69a to your computer and use it in GitHub Desktop.
Save maxxscho/b983984867df49cca69a to your computer and use it in GitHub Desktop.
Animated Burger Icon for usage with bourbon.
.mobile-nav-toggler {
@include prefixer(transform, rotate(0deg), webkit moz ms o spec);
@include transition(all 0.5s ease-in-out);
cursor: pointer;
height: 21px;
position: absolute;
right: 0;
top: 22px;
width: 30px;
span {
@include prefixer(transform, rotate(0deg), webkit moz ms o spec);
@include transition(all 0.25s ease-in-out);
background: red;
border-radius: 3px;
display: block;
height: 3px;
left: 0;
opacity: 1;
position: absolute;
width: 100%;
&:nth-child(1) {
top: 0;
}
&:nth-child(2) {
top: 9px;
}
&:nth-child(3) {
top: 18px;
}
}
&.is-open {
span {
&:nth-child(1) {
@include prefixer(transform, rotate(135deg), webkit moz ms o spec);
top: 9px;
}
&:nth-child(2) {
left: -60px;
opacity: 0;
}
&:nth-child(3) {
@include prefixer(transform, rotate(-135deg), webkit moz ms o spec);
top: 9px;
}
}
}
}
<div class="mobile-nav-toggler js-mobile-nav-toggler">
<span></span>
<span></span>
<span></span>
</div>
$(document).ready(function(){
$('.js-mobile-nav-toggler').on('click', function() {
$(this).toggleClass('is-open');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment