Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                #navicon
  .bar
  .bar
  .bar

// Simple hamburger icon animation
// Inspired by Zarin Ficklin's [dribble shot](//dribbble.com/shots/1275053-Menu-Gifa)

ul#credits
  ol: a(href="http://hhsnopek.me") Henry Snopek
  ol: a(href="http://dribbble.com/shots/1275053-Menu-Gifa") Inspired by Zarin Flickin
  
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Open+Sans')

body
  background-color #333

#navicon
  position absolute
  top 50%
  left 50%
  transform translate(-50%, -50%)

  width 35px
  height 30px
  padding-top 20px

  .bar
    width 50px
    height 2px
    background-color white
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);

  .bar:nth-of-type(2)
    margin-top -20px

  .bar:nth-of-type(3)
    margin-top 32px

#navicon.active
  .bar:nth-of-type(1)
    -webkit-animation: dissappear .5s ease;
    -moz-animation:    dissappear .5s ease;
    -o-animation:      dissappear .5s ease;
    animation:         dissappear .5s ease;
    -webkit-animation-fill-mode: forwards;
    -mox-animation-fill-mode: forwards;
    -o-animation-fill-mode: forwards;
    animation-fill-mode: forwards;

  .bar:nth-of-type(2)
    -webkit-animation: squishTop .5s ease;
    -moz-animation:    squishTop .5s ease;
    -o-animation:      squishTop .5s ease;
    animation:         squishTop .5s ease;
    -webkit-animation-fill-mode: forwards;
    -mox-animation-fill-mode: forwards;
    -o-animation-fill-mode: forwards;
    animation-fill-mode: forwards;

  .bar:nth-of-type(3)
    -webkit-animation: squishBottom .5s ease;
    -moz-animation:    squishBottom .5s ease;
    -o-animation:      squishBottom .5s ease;
    animation:         squishBottom .5s ease;
    -webkit-animation-fill-mode: forwards;
    -mox-animation-fill-mode: forwards;
    -o-animation-fill-mode: forwards;
    animation-fill-mode: forwards;

#navicon.inactive
  .bar:nth-of-type(1)
    -webkit-animation: dissappearRev .5s ease;
    -moz-animation:    dissappearRev .5s ease;
    -o-animation:      dissappearRev .5s ease;
    animation:         dissappearRev .5s ease;
    -webkit-animation-fill-mode: forwards;
    -mox-animation-fill-mode: forwards;
    -o-animation-fill-mode: forwards;
    animation-fill-mode: forwards;

  .bar:nth-of-type(2)
    -webkit-animation: squishTopRev .5s ease;
    -moz-animation:    squishTopRev .5s ease;
    -o-animation:      squishTopRev .5s ease;
    animation:         squishTopRev .5s ease;
    -webkit-animation-fill-mode: forwards;
    -mox-animation-fill-mode: forwards;
    -o-animation-fill-mode: forwards;
    animation-fill-mode: forwards;

  .bar:nth-of-type(3)
    -webkit-animation: squishBottomRev .5s ease;
    -moz-animation:    squishBottomRev .5s ease;
    -o-animation:      squishBottomRev .5s ease;
    animation:         squishBottomRev .5s ease;
    -webkit-animation-fill-mode: forwards;
    -mox-animation-fill-mode: forwards;
    -o-animation-fill-mode: forwards;
    animation-fill-mode: forwards;



@keyframes squishBottom {
  0% {
    margin-top 32px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  50% {
    margin-top -3px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  75% {
    margin-top -3px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    margin-top -3px
    -webkit-transform: rotate(-135deg);
    -moz-transform: rotate(-135deg);
    -o-transform: rotate(-135deg);
    transform: rotate(-135deg);  
  }
}

@keyframes squishTop {
  0% {
    margin-top -20px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  50% {
    margin-top -3px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  75% {
    margin-top -3px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    margin-top -3px
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);  
  }
}

@keyframes dissappear {
  0% {
    opacity 1
  }
  50% {
    opacity 1
  }
  65% {
    opacity 0
  }
  100% {
    opacity 0
  }
}

@keyframes squishBottomRev {
  0% {
    margin-top -3px
    -webkit-transform: rotate(-135deg);
    -moz-transform: rotate(-135deg);
    -o-transform: rotate(-135deg);
    transform: rotate(-135deg);  
  }
  50% {
    margin-top -3px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  75% {
    margin-top -3px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    margin-top 32px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
}

@keyframes squishTopRev {
  0% {
    margin-top -3px
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);  
  }
  50% {
    margin-top -3px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  75% {
    margin-top -3px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    margin-top -20px
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
}

@keyframes dissappearRev {
  0% {
    opacity 0
  }
  
  50% {
    opacity 0
  }
  100% {
    opacity 1
  }
}


#credits
  position absolute
  bottom 5%
  right 5%
  font-family 'Open Sans', sans-serif
  font-weight 400
  ol
    display inline-block
    a
      text-decoration none
      color white
    a:hover
      color #F14189

              
            
!

JS

              
                active = true
$('#navicon').click( () ->
  if active is true
    $('#navicon').removeClass('inactive').addClass('active')
    active = false
    console.log active
  else
    $('#navicon').removeClass('active').addClass('inactive')
    active = true
    console.log active
)

              
            
!
999px

Console