Last active
February 13, 2017 16:50
-
-
Save merli129/55c3f609fc7a898a38c4f45d644ddbed to your computer and use it in GitHub Desktop.
Animated Sandwich Icon
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
| <div id='sandwich'> | |
| <div class='sw-topper'></div> | |
| <div class='sw-bottom'></div> | |
| <div class='sw-footer'></div> | |
| </div> |
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
| $("#sandwich").click(function() { | |
| $("#sandwich").toggleClass("active"); | |
| }); |
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: 27px | |
| $h: 3px | |
| #sandwich | |
| width: $w | |
| height: $h | |
| position: absolute | |
| top: 0 | |
| bottom: 20px | |
| left: 0 | |
| right: 0 | |
| margin: auto | |
| .sw-topper | |
| position: relative | |
| top: 0 | |
| width: $w | |
| height: $h | |
| background: rgb(255, 255, 255) | |
| border: none | |
| border-radius: 4px 4px 4px 4px | |
| transition: transform 0.5s, top 0.2s | |
| //transition-delay: 0.2s, 0s | |
| .sw-bottom | |
| position: relative | |
| width: $w | |
| height: $h | |
| top: $h * 2 | |
| background: rgb(255, 255, 255) | |
| border: none | |
| border-radius: 4px 4px 4px 4px | |
| transition: transform 0.5s, top 0.2s | |
| transition-delay: 0.2s, 0s | |
| .sw-footer | |
| position: relative | |
| width: $w | |
| height: $h | |
| top: $h * 4 | |
| background: rgb(255, 255, 255) | |
| border: none | |
| border-radius: 4px 4px 4px 4px | |
| transition: all 0.5s | |
| transition-delay: 0.1s | |
| #sandwich.active | |
| .sw-topper | |
| top: $h*3 | |
| transform: rotate(140deg) | |
| .sw-bottom | |
| top: $h*2 | |
| transform: rotate(-140deg) | |
| .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