Skip to content

Instantly share code, notes, and snippets.

@IvanofSA
Created May 29, 2016 18:29
Show Gist options
  • Save IvanofSA/435518073a29aeb05bb3dbb380304241 to your computer and use it in GitHub Desktop.
Save IvanofSA/435518073a29aeb05bb3dbb380304241 to your computer and use it in GitHub Desktop.
button.toggle_mnu
span.sandwich
span.sw-topper
span.sw-bottom
span.sw-footer
$(".toggle_mnu").click(function() {
$(".sandwich").toggleClass("active");
});
$(".top_mnu ul a").click(function() {
$(".top_mnu").fadeOut(600);
$(".sandwich").toggleClass("active");
$(".top_text").css("opacity", "1");
}).append("<span>");
$(".toggle_mnu").click(function() {
if ($(".top_mnu").is(":visible")) {
$(".top_text").css("opacity", "1");
$(".top_mnu").fadeOut(600);
$(".top_mnu li a").removeClass("fadeInUp animated");
} else {
$(".top_text").css("opacity", ".1");
$(".top_mnu").fadeIn(600);
$(".top_mnu li a").addClass("fadeInUp animated");
};
});
.toggle_mnu{
display: none;
width: 40px;
height: 40px;
position: fixed;
z-index: 7600;
border: none;
right: 20px;
top: 20px;
span{
display: block;
}
}
$w: 28px;
$h: 3px;
.sandwich {
width: $w;
height: $w;
position: absolute;
top: 8px;
bottom: 0;
left: 0;
right: 0;
margin: auto;
z-index: 200;
}
.sw-topper{
position: relative;
top: 0;
width: $w;
height: $h;
background: rgb(255, 255, 255);
border: none;
border-radius: 4px 4px 4px 4px;
transition: transform 0.5s, top 0.2s;
display: block;
}
//transition-delay: 0.2s, 0
.sw-bottom{
position: relative;
width: $w;
height: $h;
top: $h * 2.2;
background: rgb(255, 255, 255);
border: none;
border-radius: 4px 4px 4px 4px;
transition: transform 0.5s, top 0.2s;
transition-delay: 0.2s, 0s;
}
.sw-footer{
position: relative;
width: $w;
height: $h;
top: $h * 4.5;
background: rgb(255, 255, 255);
border: none;
border-radius: 4px 4px 4px 4px;
transition: all 0.5s;
transition-delay: 0.1s;
}
.sandwich.active{
.sw-topper{
top: 9px;
transform: rotate(-45deg);
}
.sw-bottom{
top: 6px;
transform: rotate(45deg);
}
.sw-footer{
opacity: 0;
top: 0;
transform: rotate(180deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment