vue-burger-button
Version:
A Vue burger button as functional component, which is faster than a regular component, and is pretty small (JS min+gzip is lower than 700b and CSS min+gzip is lower than 400b).
41 lines (39 loc) • 923 B
CSS
.burguer-button {
appearance: none;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-top: 0;
padding-left: 0;
padding-right: 0;
padding-bottom: 0;
border-width: 0;
border-style: none;
border-color: transparent;
background-image: none;
background-color: transparent;
outline: none;
cursor: pointer;
}
.burguer-button > .bar {
display: block;
border-radius: 25px;
background-color: #000;
transition: opacity 0.2s ease-in, transform 0.2s ease-out;
}
.burguer-button > .bar:nth-child(1) {
transform: translateY(-75%);
}
.burguer-button > .bar:nth-child(3) {
transform: translateY(75%);
}
.burguer-button.-active > .bar:nth-child(2) {
opacity: 0;
}
.burguer-button.-active > .bar:nth-child(1) {
transform: translateY(100%) rotate(45deg);
}
.burguer-button.-active > .bar:nth-child(3) {
transform: translateY(-100%) rotate(-45deg);
}