<div class="menu-wrapper">
<div class="hamburger-menu"></div>
</div>
$bar-width: 100px;
$bar-height: 10px;
$bar-spacing: 25px;
body {
background: #F44336;
}
.menu-wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: $bar-width;
height: $bar-height + $bar-spacing*2;
cursor: pointer;
}
.hamburger-menu,
.hamburger-menu:after,
.hamburger-menu:before {
width: $bar-width;
height: $bar-height;
}
.hamburger-menu {
position: relative;
transform: translateY($bar-spacing);
background: rgba(255, 255, 255, 1);
transition: all 0ms 300ms;
&.animate {
background: rgba(255, 255, 255, 0);
}
}
.hamburger-menu:before {
content: "";
position: absolute;
left: 0;
bottom: $bar-spacing;
background: rgba(255, 255, 255, 1);
transition: bottom 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms cubic-bezier(0.23, 1, 0.32, 1);
}
.hamburger-menu:after {
content: "";
position: absolute;
left: 0;
top: $bar-spacing;
background: rgba(255, 255, 255, 1);
transition: top 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms cubic-bezier(0.23, 1, 0.32, 1);
}
.hamburger-menu.animate:after {
top: 0;
transform: rotate(45deg);
transition: top 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1);;
}
.hamburger-menu.animate:before {
bottom: 0;
transform: rotate(-45deg);
transition: bottom 300ms cubic-bezier(0.23, 1, 0.32, 1), transform 300ms 300ms cubic-bezier(0.23, 1, 0.32, 1);;
}
View Compiled
(function () {
$('.menu-wrapper').on('click', function() {
$('.hamburger-menu').toggleClass('animate');
})
})();
This Pen doesn't use any external CSS resources.