cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="hamburger closed">
  <div class="burger-main">
    <div class="burger-inner">
      <span class="top"></span>
      <span class="mid"></span>
      <span class="bot"></span>
    </div>
  </div>

  <div class="svg-main">
    <svg class="svg-circle">
    <path class="path" fill="none" stroke="#fff" stroke-miterlimit="10" stroke-width="4" d="M 34 2 C 16.3 2 2 16.3 2 34 s 14.3 32 32 32 s 32 -14.3 32 -32 S 51.7 2 34 2"/>
    </svg>
  </div>
  <div class="path-burger">
    <div class="animate-path">
      <div class="path-rotation"></div>
    </div>
  </div>
</div>
            
          
!
            
              *,
*:before,
*:after {
  box-sizing: border-box;
}

body {
  background: #973BE8;
  padding: 40px;
}

.hamburger {
  -webkit-transform: scale(1);
  transform: scale(1);
  margin: 40px auto;
  position: relative;
  display: block;
  width: 68px;
  height: 68px;
  background: #973BE8;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.burger-main {
  position: absolute;
  padding: 20px 16px;
  height: 68px;
  width: 68px;
}

.burger-inner {
  position: relative;
  height: 28px;
  width: 36px;
}

.burger-main span {
  position: absolute;
  display: block;
  height: 4px;
  width: 36px;
  border-radius: 2px;
  background: #fff;
}

.top {
  top: 0;
  transform-origin: 34px 2px;
}

.bot {
  bottom: 0;
  transform-origin: 34px 2px;
}

.mid {
  top: 12px;
}

.svg-main {
  position: absolute;
  top: 0;
  left: 0;
  width: 68px;
  height: 68px;
}

.circle {
  width: 68px;
  height: 68px;
}

.path {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  stroke-linejoin: round;
}

.hamburger.open .path {
  animation: dash-in 0.6s linear normal;
  animation-fill-mode: forwards;
}

.hamburger.closed .path {
  animation: dash-out 0.6s linear normal;
  animation-fill-mode: forwards;
}

.hamburger.open .top {
  animation: close-top-out 0.6s linear normal;
  animation-fill-mode: forwards;
}

.hamburger.open .bot {
  animation: close-bot-out 0.6s linear normal;
  animation-fill-mode: forwards;
}

.hamburger.closed .top {
  animation: close-top-in 0.6s linear normal;
  animation-fill-mode: forwards;
}

.hamburger.closed .bot {
  animation: close-bot-in 0.6s linear normal;
  animation-fill-mode: forwards;
}

.hamburger.open .mid {
  animation: burger-fill-out 0.6s linear normal;
  animation-fill-mode: forwards;
}

.hamburger.closed .mid {
  animation: burger-fill-in 0.6s linear normal;
}

.path-burger {
  position: absolute;
  top: 0;
  left: 0;
  height: 68px;
  width: 68px;
  -webkit-mask: url(#mask);
  mask: url(#mask);
  -webkit-mask-box-image: url(http://dev.awsm.in/codepen/mask.svg);
}

.animate-path {
  position: absolute;
  top: 0;
  left: 0;
  width: 68px;
  height: 68px;
}

.path-rotation {
  height: 34px;
  width: 34px;
  margin: 34px 34px 0 0;
  -webkit-transform: rotate(0deg);
  transform: rotate(0deg);
  -webkit-transform-origin: 100% 0;
  transform-origin: 100% 0;
}

.path-rotation:before {
  content: '';
  display: block;
  width: 30px;
  height: 34px;
  margin: 0 4px 0 0;
  background: #fff;
}

.hamburger.open .animate-path {
  animation: circle-in 0.6s linear normal;
  animation-fill-mode: forwards;
}

.hamburger.closed .animate-path {
  animation: circle-out 0.6s linear normal;
  animation-fill-mode: forwards;
}

@-webkit-keyframes dash-in {
  0% {
    stroke-dashoffset: 240;
  }

  40% {
    stroke-dashoffset: 240;
  }

  100% {
    stroke-dashoffset: 0;
  }

}

@keyframes dash-in {
  0% {
    stroke-dashoffset: 240;
  }

  40% {
    stroke-dashoffset: 240;
  }

  100% {
    stroke-dashoffset: 0;
  }

}

@-webkit-keyframes dash-out {
  0% {
    stroke-dashoffset: 0;
  }

  40% {
    stroke-dashoffset: 240;
  }

  100% {
    stroke-dashoffset: 240;
  }

}

@keyframes dash-out {
  0% {
    stroke-dashoffset: 0;
  }

  40% {
    stroke-dashoffset: 240;
  }

  100% {
    stroke-dashoffset: 240;
  }

}

@keyframes close-top-out {
  0% {
    left: 0;
    top: 0;
    transform: rotate(0deg);
  }

  20% {
    left: 0;
    top: 0;
    transform: rotate(15deg);
  }

  80% {
    left: -5px;
    top: 0;
    transform: rotate(-60deg);
  }

  100% {
    left: -5px;
    top: 1px;
    transform: rotate(-45deg);
  }

}

@keyframes close-bot-out {
  0% {
    left: 0;
    transform: rotate(0deg);
  }

  20% {
    left: 0;
    transform: rotate(-15deg);
  }

  80% {
    left: -5px;
    transform: rotate(60deg);
  }

  100% {
    left: -5px;
    transform: rotate(45deg);
  }

}

@keyframes close-top-in {
  0% {
    left: -5px;
    bot: 0;
    transform: rotate(-45deg);
  }

  20% {
    left: -5px;
    bot: 0;
    transform: rotate(-60deg);
  }

  80% {
    left: 0;
    bot: 0;
    transform: rotate(15deg);
  }

  100% {
    left: 0;
    bot: 1px;
    transform: rotate(0deg);
  }

}

@keyframes close-bot-in {
  0% {
    left: -5px;
    transform: rotate(45deg);
  }

  20% {
    left: -5px;
    transform: rotate(60deg);
  }

  80% {
    left: 0;
    transform: rotate(-15deg);
  }

  100% {
    left: 0;
    transform: rotate(0deg);
  }

}

@keyframes burger-fill-in {
  0% {
    width: 0;
    left: 36px;
  }

  40% {
    width: 0;
    left: 40px;
  }

  80% {
    width: 36px;
    left: -6px;
  }

  100% {
    width: 36px;
    left: 0px;
  }

}

@keyframes burger-fill-out {
  0% {
    width: 36px;
    left: 0px;
  }

  20% {
    width: 42px;
    left: -6px;
  }

  40% {
    width: 0;
    left: 40px;
  }

  100% {
    width: 0;
    left: 36px;
  }

}
@keyframes circle-out {
  0% {
    transform: rotate(0deg);
  }

  40% {
    transform: rotate(180deg);
  }

  100% {
    transform: rotate(360deg);
  }

}


@keyframes circle-in {
  0% {
    transform: rotate(360deg);
  }

  40% {
    transform: rotate(180deg);
  }

  100% {
    transform: rotate(0deg);
  }

}
            
          
!
            
              $('document').ready(function () {
      var Closed = false;

      $('.hamburger').click(function () {
        if (Closed == true) {
          $(this).removeClass('open');
          $(this).addClass('closed');
          Closed = false;
        } else {               
          $(this).removeClass('closed');
          $(this).addClass('open');
          Closed = true;
        }
      });
});
            
          
!
999px
Loading ..................

Console