Last active
April 13, 2016 16:13
-
-
Save aligator28/0d6b74a92790eab34d5163460a5516ff to your computer and use it in GitHub Desktop.
Animated Sandwich Button (3 horizontal dashes transforms into cross)
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
$w: 32px | |
$h: 4px | |
//if we don't use divs in html file | |
#sandwich, .sw-topper, .sw-bottom, .sw-footer | |
display: block | |
.sw-topper, .sw-bottom, .sw-footer | |
width: $w | |
height: $h | |
position: relative | |
background: rgb(255, 255, 255) | |
border: none | |
border-radius: 4px 4px 4px 4px | |
#sandwich | |
width: $w | |
height: $w | |
position: absolute | |
top: 0 | |
bottom: 0 | |
left: 0 | |
right: 0 | |
margin: auto | |
z-index: 200 | |
.sw-topper | |
top: 0 | |
transition: transform 0.5s, top 0.2s | |
//transition-delay: 0.2s, 0s | |
.sw-bottom | |
top: $h * 2 | |
transition: transform 0.5s, top 0.2s | |
transition-delay: 0.2s, 0s | |
.sw-footer | |
top: $h * 4 | |
transition: all 0.5s | |
transition-delay: 0.1s | |
#sandwich.active | |
.sw-topper | |
top: 9px | |
transform: rotate(135deg) | |
.sw-bottom | |
top: 5px | |
transform: rotate(-135deg) | |
.sw-footer | |
opacity: 0 | |
top: 0 | |
transform: rotate(180deg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment