Skip to content

Instantly share code, notes, and snippets.

@pongstr
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pongstr/86b2456c3fe5ed08f8ae to your computer and use it in GitHub Desktop.
Save pongstr/86b2456c3fe5ed08f8ae to your computer and use it in GitHub Desktop.
menu-x-menu

Haml

%button.triggr
  - (1..3).each do |i|
    %span.icon-bar

sass with compass

*,*:before,*:after
  @include box-sizing(border-box)

*:focus
  outline: 0 none
 
.triggr
  position: fixed
  top: 25px
  left: 25px
  display: inline-block
  height: 45px
  margin: 5px 15px
  padding: 10px
  border: 1px solid #ddd
  background-color: transparent
  
.icon-bar
  position: relative
  display: block
  width: 35px
  height: 5px
  margin-top: 4px
  margin-bottom: 4px
  
  &:first-child,
  &:last-child
    margin: 0
  

.icon-bar:before
  @include transition(all .5s ease)
  content: " "
  display: block
  width: 100%
  height: 100%
  background-color: #000

.triggr.active .icon-bar
  position: absolute
  top: 45%
  
  &:before
    @include transition(all .5s ease)

.triggr .icon-bar:nth-of-type(1):before
  @include transform(rotate(-180deg))

.triggr.active .icon-bar:nth-of-type(1):before
  @include transform(rotate(48deg))

.triggr .icon-bar:nth-of-type(2):before
  @include transition(opacity 1s ease)
  margin: 0
  opacity: 1
  
.triggr.active .icon-bar:nth-of-type(2):before
  opacity: 0

.triggr .icon-bar:nth-of-type(3):before
  @include transform(rotate(180deg))
    
.triggr.active .icon-bar:nth-of-type(3):before
  @include transform(rotate(-48deg))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment