<div class="burger-menu">
<span id="left" class="burg"></span>
<span id="right" class="burg"></span>
<span id="none" class="burg"></span>
</div>
burger-menu {
display: none;
position: relative;
width: 30px;
height: 23px;
cursor: pointer;
z-index: 30;
}
.burg {
position: absolute;
display: block;
width: 100%;
height: 3px;
background-color: #000;
transition: width 0.2s ease, top 0.2s ease, background-color 0.2s ease,
transform 0.2s ease, opacity 0.2s ease;
}
.burg:nth-child(2) {
top: 10px;
}
.burg:nth-child(3) {
top: 20px;
}
.burger-menu:hover .burg {
background-color: var(--main-color);
}
.burger-menu:active .burg {
background-color: var(--active-color);
}
.burger-menu:hover .burg:nth-child(2) {
width: 25px;
}
.burger-menu:hover .burg:nth-child(3) {
width: 18px;
}
.burg:not(:last-child) {
margin-bottom: 7px;
}
$(".burger-menu").on("click", () => {
$("#none").css("opacity", "0");
$("#left").css({
transform: "translateY(10px) rotate(45deg)",
});
$("#right").css({
transform: "rotate(-45deg)",
});
if ($("#none").css("opacity") === "0") {
$("#none").css("opacity", "1");
$("#left").css("transform", "translateY(0px) rotate(0)");
$("#right").css("transform", "rotate(0)");
}
$(".burger_list").slideToggle(400);
});