Skip to content

Instantly share code, notes, and snippets.

@jlaguilargomez
Created April 7, 2020 14:40
Show Gist options
  • Save jlaguilargomez/bbd1c2c3400340946f2478b538aea63b to your computer and use it in GitHub Desktop.
Save jlaguilargomez/bbd1c2c3400340946f2478b538aea63b to your computer and use it in GitHub Desktop.
NavButton with animation
.navigation {
&__checkbox {
display: none;
}
&__button {
display: flex;
align-items: center;
justify-content: center;
width: 64px;
height: 100%;
background: #303f8b;
cursor: pointer;
}
&__button:hover &__icon::before {
top: -1rem;
}
&__button:hover &__icon::after {
top: 1rem;
}
// ICON
&__icon {
position: relative;
&,
&::before,
&::after {
display: inline-block;
width: 3rem;
height: 2px;
border-radius: 2px;
background-color: white;
}
&::before,
&::after {
content: '';
position: absolute;
left: 0;
transition: all 0.2s;
}
&::before {
top: -0.7rem;
}
&::after {
top: 0.7rem;
}
}
&__checkbox:checked + &__button &__icon {
background-color: transparent;
}
&__checkbox:checked + &__button &__icon::before {
top: 0;
transform: rotate(135deg);
}
&__checkbox:checked + &__button &__icon::after {
top: 0;
transform: rotate(-135deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment