Skip to content

Instantly share code, notes, and snippets.

@muks999
Created June 14, 2018 00:52
Show Gist options
  • Save muks999/2923c8c661b1cb7f4a46338f4ad9a445 to your computer and use it in GitHub Desktop.
Save muks999/2923c8c661b1cb7f4a46338f4ad9a445 to your computer and use it in GitHub Desktop.
Sandwich
.sandwich
.sandwich__line.sandwich__line--top
.sandwich__line.sandwich__line--middle
.sandwich__line.sandwich__line--bottom
.sandwich {
cursor: pointer;
display: none;
height: 20px;
position: relative;
width: 32px;
@media screen and (max-width: $tablet-wide) { display: block; }
&--active {
.sandwich__line {
&--top {
top: 10px;
transform: rotate(45deg);
}
&--middle { opacity: 0; }
&--bottom {
top: 10px;
transform: rotate(-45deg);
}
}
}
&__line {
background-color: $white;
display: block;
height: 2px;
left: 0;
position: absolute;
transition: all linear .4s;
width: 100%;
&--top { top: 0; }
&--middle { top: 9px; }
&--bottom { top: 18px; }
}
}
var sandwich = function () {
$(document).on('click', '.sandwich', function () {
$(this).toggleClass('sandwich--active');
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment