Skip to content

Instantly share code, notes, and snippets.

@vofus
Last active October 17, 2015 22:24
Show Gist options
  • Select an option

  • Save vofus/2303d7d81c96eb328fb4 to your computer and use it in GitHub Desktop.

Select an option

Save vofus/2303d7d81c96eb328fb4 to your computer and use it in GitHub Desktop.
Sandwich menu
<span class="sandwich">
<span class="sw-topper"></span>
<span class="sw-bottom"></span>
<span class="sw-footer"></span>
</span>
$(".sandwich").click(function() {
$(".sandwich").toggleClass("active");
});
$w: 40px
$h: 4px
.sandwich
z-index: 100
display: block
width: $w
height: $w
position: absolute
top: 10px
bottom: 0
left: 0
right: 0
margin: auto
.sw-topper
display: block
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
display: block
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
display: block
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: 12px
transform: rotate(140deg)
.sw-bottom
top: 8px
transform: rotate(-140deg)
.sw-footer
opacity: 0
top: 0
transform: rotate(180deg)
@vofus
Copy link
Author

vofus commented Oct 17, 2015

Thanks for the code:

http://codepen.io/anon/pen/azYBoX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment