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

Auto Save

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

              
                <div class="burger-wrapper">
  <h1>Hamburger Animated Menus</h1>
  <div class="item">
    <!-- BURGER ONE -->
    <h3>Flyout<span>Burger Menu One</span></h3>
    <div class="burger one">
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  
  <div class="item">
    <!-- BURGER TWO -->
    <h3>Fadeout<span>Burger Menu Two</span></h3>
    <div class="burger two">
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  
  <div class="item">
    <!-- BURGER THREE -->
    <h3>Butterfly<span>Burger Menu Three</span></h3>
    <div class="burger three">
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  
  <div class="item">
    <!-- BURGER FOUR --> 
    <h3>Rocket<span>Burger Menu Four</span></h3>
    <div class="burger four">
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  
  <div class="item">
    <!-- BURGER FIVE -->
    <h3>Collapsable Segments<span>Burger Menu Five</span></h3>
    <div class="burger five">
      <div class="column-one">
        <span></span>
        <span></span>
        <span></span>
      </div>
      <div class="column-two">
        <span></span>
        <span></span>
        <span></span>
      </div>
    </div>
  </div>

  <div class="item">
    <!-- BURGER SIX -->
    <h3>Spining <span>Burger Menu Six</span></h3>
    <div class="burger six">
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  
  <div class="item">
    <!-- BURGER SEVEN -->
    <h3>Blink <span>Burger Menu Seven</span></h3>
    <div class="burger seven">
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  
  <div class="item">
    <!-- BURGER EIGHT -->
    <h3>Square <span>Burger Menu Eight</span></h3>
    <div class="burger eight">
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>

  <div class="item">
    <!-- BURGER NINE -->
    <h3>Circle <span>Burger Menu Nine</span></h3>
    <div class="burger nine">
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  
  <div class="item">
    <!-- BURGER TEN -->
    <h3>Two Step <span>Burger Menu Ten</span></h3>
    <div class="burger ten">
      <span></span>
      <span></span>
    </div>
  </div>
  
  <div class="item">
    <!-- BURGER TEN -->
    <h3>Just a Burger <span>Burger Menu Eleven</span></h3>
    <div class="burger eleven">
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
</div>
              
            
!

CSS

              
                @background-color: #191a1e;

//Burger Variables - COPY
@burger-width: 30px;
@burger-height: 30px;
@burger-thickness: 3px;
@burger-color: #FFF;
@burger-activated-color: gold;


body {
  background-color: @background-color;
}

h1,
h3 {
  font-family: sans-serif;
  color: @burger-color;
  span {
    text-transform: uppercase;
    font-size: 12px;
    display: block;
  }
}

h1 {
  width: 100%;
}

.burger-wrapper {
  padding: 30px;
  display: flex;
  flex-wrap: wrap;

  .item {
    width: calc(33% - 30px);
    padding: 15px;
  } 
}

.burger {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  justify-content: space-between;
  width: @burger-width;
  height: @burger-height;
  padding: 10px;
  cursor: pointer;
  overflow: hidden;
  
  span {
    width: 100%;
    height: @burger-thickness;
    background-color: @burger-color;
    transition: all 0.25s;
  }
  
  &.activated {
    span {
      background-color: @burger-activated-color;
    }
  }
  
////////////////////////////////////////////////////////////////////////////
// BURGER ONE
////////////////////////////////////////////////////////////////////////////
  &.one {
    &.activated {
      span {
        &:nth-child(1) {
          transform: 
            translateY((@burger-height / 2) - @burger-thickness)
            rotate(45deg);
        }
        &:nth-child(2) {
          transform:
            translateX(100px);
        }
        &:nth-child(3) {
          transform: 
            translateY(-@burger-height / 2)
            rotate(-45deg);
        }
      }
    }
  }
  
////////////////////////////////////////////////////////////////////////////
// BURGER TWO
////////////////////////////////////////////////////////////////////////////
  &.two {
    &.activated {
      span {
        &:nth-child(1) {
          transform: 
            translateY((@burger-height / 2) - @burger-thickness)
            rotate(45deg);
        }
        &:nth-child(2) {
          opacity: 0;
        }
        &:nth-child(3) {
          transform: 
            translateY(-@burger-height / 2)
            rotate(-45deg);
        }
      }
    }
  }
  
////////////////////////////////////////////////////////////////////////////
// BURGER THREE
////////////////////////////////////////////////////////////////////////////
  @keyframes top-spin {
    0%   {
      transform: 
        translateY(0px)
        rotate(0deg);
    }
    25%  {
      transform: 
        translateY((@burger-height / 2) - 3px)
        rotate(45deg);
    }
    100%  {
      transform:
        translateY((@burger-height / 2) - 3px)
        rotate(-135deg);
    }
  }
  
  @keyframes bottom-spin {
    0%   {
      transform: 
        translateY(0px)
        rotate(0deg);
    }
    25%  {
      transform: 
        translateY(-@burger-height / 2)
        rotate(-45deg);
    }
    100%  {
      transform:
        translateY(-@burger-height / 2)
        rotate(135deg);
    }
  }
  
  &.three {
    &.activated {
      span {
        &:nth-child(1),
        &:nth-child(3) {
          animation-duration: .75s;
        }
        
        &:nth-child(1) {
          animation-name: top-spin;
          transform:
            translateY((@burger-height / 2) - @burger-thickness)
            rotate(45deg);
        }
        &:nth-child(2) {
          opacity: 0;
        }
        &:nth-child(3) {
          animation-name: bottom-spin;
          transform: 
            translateY(-@burger-height / 2)
            rotate(-45deg);
        }
      }
    }
  }
  
////////////////////////////////////////////////////////////////////////////
// BURGER FOUR
////////////////////////////////////////////////////////////////////////////
  &.four {
    &.activated {
      span {
        &:nth-child(1),
        &:nth-child(3) {
          width: 80%;
        }
        &:nth-child(2) {
          width: 50%;
          transform: translateX(100%);
        }
      }
    }
  }
  
////////////////////////////////////////////////////////////////////////////
// BURGER FIVE
////////////////////////////////////////////////////////////////////////////
// Based on the thickness variable, the X and Y coordinates may need to be adjusted //
  
  &.five {
    flex-direction: row;
    
    .column-one,
    .column-two {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      width: 50%;
    }
    span {
      width: 100%;
    }
    
    &.activated {
      span {
        &:nth-child(1) {
          transform:
            translateY((@burger-height / 2) - 11px)
            translateX(4px)
            rotate(45deg);
        }
        &:nth-child(2) {
          transform:
            translateX(100px);
            
        }
        &:nth-child(3) {
          transform:
            translateY((-@burger-height / 2) + 11px)
              translateX(2px)
              rotate(-45deg);
        }
      }
      
      .column-two {
        span {
          &:nth-child(1) {
            transform:
              translateY((@burger-height / 2) - 11px)
              translateX(-2px)
              rotate(-45deg);
          }
          &:nth-child(2) {
            transform:
              translateX(-100px);
          }
          &:nth-child(3) {
            transform:
              translateY((-@burger-height / 2) + 11px)
              translateX(-2px)
              rotate(45deg);
          }
        }
      }
    }
  }
  
////////////////////////////////////////////////////////////////////////////
// BURGER SIX
////////////////////////////////////////////////////////////////////////////
  &.six {
    transition: all 0.25s;
    &.activated {
      transform:
        rotate(360deg);
      
      span {
        &:nth-child(1) {
          transform: 
            translateY((@burger-height / 2) - @burger-thickness)
            rotate(45deg);
        }
        &:nth-child(2) {
          opacity: 0;
        }
        &:nth-child(3) {
          transform: 
            translateY(-@burger-height / 2)
            rotate(-45deg);
        }
      }
    }
  }
  
////////////////////////////////////////////////////////////////////////////
// BURGER SEVEN
////////////////////////////////////////////////////////////////////////////

  @keyframes middlebar {
    0% {transform: scaleY(0);}
    25% {transform: scaleY(12);}
    75% {transform: scaleY(12);}
    100% {transform: scaleY(0);}
  }
  
  &.seven {
    &.activated {
      
      span {
        &:nth-child(2) {
          z-index: 1;
          background-color: @background-color;
          animation-name: middlebar;
          animation-duration: .75s;
          animation-fill-mode: forwards;
        }
        
        &:nth-child(1) {
          transition-delay: .25s;
          transform: 
            translateY((@burger-height / 2) - @burger-thickness)
            rotate(45deg);
        }
        &:nth-child(3) {
          transition-delay: .25s;
          transform: 
            translateY(-@burger-height / 2)
            rotate(-45deg);
        }
      }
    }
  }
  
////////////////////////////////////////////////////////////////////////////
// BURGER EIGHT
////////////////////////////////////////////////////////////////////////////
  &.eight {
    border: 2px solid transparent;
    
    &.activated {
      border: 1px solid @burger-activated-color;
      span {
        &:nth-child(1) {
          transform: 
            translateY((@burger-height / 2) - (@burger-thickness - 1))
            rotate(45deg);
        }
        &:nth-child(2) {
          opacity: 0;
        }
        &:nth-child(3) {
          transform: 
            translateY((-@burger-height / 2) + 1)
            rotate(-45deg);
        }
      }
    }
  }
  
////////////////////////////////////////////////////////////////////////////
// BURGER NINE
////////////////////////////////////////////////////////////////////////////
  &.nine {
    border: 2px solid transparent;
    
    &.activated {
      border: 2px solid @burger-activated-color;
      border-radius: 50%;
      span {
        &:nth-child(1) {
          transform: 
            translateY((@burger-height / 2) - (@burger-thickness - 1))
            rotate(45deg);
        }
        &:nth-child(2) {
          opacity: 0;
        }
        &:nth-child(3) {
          transform: 
            translateY((-@burger-height / 2) + 1)
            rotate(-45deg);
        }
      }
    }
  }
////////////////////////////////////////////////////////////////////////////
// BURGER TEN
////////////////////////////////////////////////////////////////////////////
  &.ten {
    justify-content: space-around;
    
    &.activated {
      // justify-content: space-between;
      span {
        &:nth-child(1) {
          transform: 
            translateY((@burger-height / 2) - (@burger-thickness + 6))
            rotate(45deg);
        }
        &:nth-child(2) {
          transform: 
            translateY((-@burger-height / 2) + 6)
            rotate(-45deg);
        }
      }
    }
  }
////////////////////////////////////////////////////////////////////////////
// BURGER ELEVEN
////////////////////////////////////////////////////////////////////////////
  @keyframes burger {
    0%  { transform: scale(1);}
    50%  { transform: scale(0.95);}
    100%  { transform: scale(1);}
  }
  
  &.eleven {
    justify-content: space-around;
    align-items: center;
    
    span {
      &:nth-child(2) {
        width: 50%;
      }
    }
    
    &.activated {
      animation-name: burger;
      animation-duration: 0.25s;
    }
  }
}
              
            
!

JS

              
                $(".burger").click(function() {
  $(this).toggleClass("activated");
});
              
            
!
999px

Console