hamburger bootstrap menu
Created
February 10, 2020 14:48
-
-
Save jseteny/207945e3016b3909d09881258ec0643f to your computer and use it in GitHub Desktop.
hamburger bootstrap menu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav class="menu"> | |
<input type="checkbox" href="#" class="menu-open" name="menu-open" id="menu-open" /> | |
<label class="menu-open-button" for="menu-open"> | |
<span class="hamburger hamburger-1"></span> | |
<span class="hamburger hamburger-2"></span> | |
<span class="hamburger hamburger-3"></span> | |
</label> | |
<a href="#" class="menu-item"> <i class="fa fa-bar-chart"></i> </a> | |
<a href="#" class="menu-item"> <i class="fa fa-plus"></i> </a> | |
<a href="#" class="menu-item"> <i class="fa fa-heart"></i> </a> | |
<a href="#" class="menu-item"> <i class="fa fa-envelope"></i> </a> | |
</nav> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alsolike( | |
// "ZOoALa", "Awesome layout ToDo list (Flexbox)", | |
// "EjOQyQ", "Create with love", | |
// "xOdKbp", "Flexbox layout off canvas navigation" | |
// ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://codepen.io/fbrz/pen/9a3e4ee2ef6dfd479ad33a2c85146fc1.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background: #ecf0f1; | |
color: #fff; | |
text-align: center; | |
} | |
a { | |
color: inherit; | |
} | |
.menu-item, | |
.menu-open-button { | |
background: #3498db; | |
border-radius: 100%; | |
width: 80px; | |
height: 80px; | |
margin-left: -40px; | |
position: absolute; | |
top: 120px; | |
color: white; | |
text-align: center; | |
line-height: 80px; | |
transform: translate3d(0, 0, 0); | |
transition: transform ease-out 200ms; | |
} | |
.menu-open { | |
display: none; | |
} | |
.hamburger { | |
width: 25px; | |
height: 3px; | |
background: white; | |
display: block; | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
margin-left: -12.5px; | |
margin-top: -1.5px; | |
transition: transform 200ms; | |
} | |
.hamburger-1 { | |
transform: translate3d(0, -8px, 0); | |
} | |
.hamburger-2 { | |
transform: translate3d(0, 0, 0); | |
} | |
.hamburger-3 { | |
transform: translate3d(0, 8px, 0); | |
} | |
.menu-open:checked + .menu-open-button .hamburger-1 { | |
transform: translate3d(0, 0, 0) rotate(45deg); | |
} | |
.menu-open:checked + .menu-open-button .hamburger-2 { | |
transform: translate3d(0, 0, 0) scale(0.1, 1); | |
} | |
.menu-open:checked + .menu-open-button .hamburger-3 { | |
transform: translate3d(0, 0, 0) rotate(-45deg); | |
} | |
.menu { | |
position: absolute; | |
left: 50%; | |
margin-left: -80px; | |
padding-top: 20px; | |
padding-left: 80px; | |
width: 650px; | |
height: 150px; | |
box-sizing: border-box; | |
font-size: 20px; | |
text-align: left; | |
} | |
.menu-item:hover { | |
background: white; | |
color: #00bcd4; | |
transition: all .3s; | |
} | |
.menu-item:nth-child(3) { | |
transition-duration: 180ms; | |
} | |
.menu-item:nth-child(4) { | |
transition-duration: 180ms; | |
} | |
.menu-item:nth-child(5) { | |
transition-duration: 180ms; | |
} | |
.menu-item:nth-child(6) { | |
transition-duration: 180ms; | |
} | |
.menu-open-button { | |
z-index: 2; | |
transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275); | |
transition-duration: 400ms; | |
transform: scale(1.1, 1.1) translate3d(0, 0, 0); | |
cursor: pointer; | |
} | |
.menu-open-button:hover { | |
transform: scale(1.2, 1.2) translate3d(0, 0, 0); | |
} | |
.menu-open:checked + .menu-open-button { | |
transition-timing-function: linear; | |
transition-duration: 200ms; | |
transform: scale(0.8, 0.8) translate3d(0, 0, 0); | |
} | |
.menu-open:checked ~ .menu-item { | |
transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1); | |
} | |
.menu-open:checked ~ .menu-item:nth-child(3) { | |
transition-duration: 190ms; | |
transform: translate3d(110px, 0, 0); | |
} | |
.menu-open:checked ~ .menu-item:nth-child(4) { | |
transition-duration: 290ms; | |
transform: translate3d(220px, 0, 0); | |
} | |
.menu-open:checked ~ .menu-item:nth-child(5) { | |
transition-duration: 390ms; | |
transform: translate3d(330px, 0, 0); | |
} | |
.menu-open:checked ~ .menu-item:nth-child(6) { | |
transition-duration: 490ms; | |
transform: translate3d(440px, 0, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment