Skip to content

Instantly share code, notes, and snippets.

@wpflames
Created August 29, 2020 17:24
Show Gist options
  • Select an option

  • Save wpflames/3dd1560bbcadf4577b33c1148607b375 to your computer and use it in GitHub Desktop.

Select an option

Save wpflames/3dd1560bbcadf4577b33c1148607b375 to your computer and use it in GitHub Desktop.
Hamburger Menu Toggle Animation 2 - SCSS
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body{
background: #272727;
min-height: 100vh;
}
.menu-btn{
position: relative;
top: 20px;
left: 20px;
display: flex;
width: 62px;
height: 62px;
cursor: pointer;
transition: all .5s ease-in-out;
border: 3px solid white;
z-index: 3;
}
.menuToggle{
position: absolute;
top: 25px;
left: 10px;
width: 36px;
height: 4px;
background: white;
border-radius: 5px;
transition: all .5s ease-in-out;
}
.menuToggle::before,
.menuToggle::after{
content: '';
position: absolute;
width: 36px;
height: 4px;
background: white;
border-radius: 5px;
transition: all .5s ease-in-out;
}
.menuToggle::before{
transform: translateY(-12px);
}
.menuToggle::after{
transform: translateY(12px);
}
//ANIMATION
.menu-btn.open .menuToggle{
transform: translateX(-100%);
background: transparent;
box-shadow: none;
&::before{
transform: rotate(45deg) translate(25px, -25px);
}
&::after{
transform: rotate(-45deg) translate(25px, 25px);
}
}
.navigation.active{
left: 0;
}
.navigation{
background: black;
position: absolute;
top: 0;
left: -100%;
height: 100%;
width: 300px;
padding: 20px;
z-index: 2;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
transition: .5s ease-in-out;
ul{
li{
list-style: none;
font-size: 2rem;
line-height: 2;
a{
color: white;
text-decoration: none;
&:hover{
color: tomato;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment