LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code
CSS
html {
  font-size: 48px;
  background: -webkit-radial-gradient(50% 16% circle, #219eb0 32%, #3f679d 88%);
  background: radial-gradient(circle at 50% 16%, #219eb0 32%, #3f679d 88%);
  height: 100%;
  width: 100%;
}

.h-menu {
  box-sizing: border-box;
  margin: auto;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-top: 1px solid #f6f6f6;
  background: -webkit-linear-gradient(top, #e0e0e0 32%, #fafafa 88%);
  background: linear-gradient(to bottom, #e0e0e0 32%, #fafafa 88%);
  border-radius: 0.5rem;
  box-shadow: 0 0.375rem 1rem 0 rgba(0, 0, 0, 0.3);
  -webkit-transition: box-shadow 0.2s, background 0.2s;
  transition: box-shadow 0.2s, background 0.2s;
  cursor: pointer;
  width: 3rem;
  height: 3rem;
  padding: 0.75rem;
}
.h-menu.is-hover {
  box-shadow: 0 0.125rem 0.75rem 0 rgba(0, 0, 0, 0.5);
  background: -webkit-linear-gradient(top, #dfdfdf 32%, #f0f0f0 88%);
  background: linear-gradient(to bottom, #dfdfdf 32%, #f0f0f0 88%);
}
.h-menu.is-mousedown {
  border-top: 1px solid #dfdfdf;
  box-shadow: 0 0px 0.5rem 0 rgba(0, 0, 0, 0.6);
}

.icn-h-menu {
  position: relative;
  top: 0.1875rem;
}
.icn-h-menu span {
  display: block;
  width: 1.5rem;
  height: 0.0625rem;
  background: #777;
  position: absolute;
  -webkit-transition: opacity 0.2s, width 0.2s, -webkit-transform 0.2s;
  transition: opacity 0.2s, width 0.2s, -webkit-transform 0.2s;
  transition: transform 0.2s, opacity 0.2s, width 0.2s;
  transition: transform 0.2s, opacity 0.2s, width 0.2s, -webkit-transform 0.2s;
}
.icn-h-menu span.ihm-2 {
  top: 0.5rem;
}
.icn-h-menu span.ihm-3 {
  top: 1rem;
}

.h-menu.is-active .icn-h-menu .ihm-1 {
  -webkit-transform: rotate(45deg) translate3d(0.375rem, 0.375rem, 0);
          transform: rotate(45deg) translate3d(0.375rem, 0.375rem, 0);
}
.h-menu.is-active .icn-h-menu .ihm-2 {
  -webkit-transform: translate3d(-1rem, 0, 0);
          transform: translate3d(-1rem, 0, 0);
  opacity: 0;
}
.h-menu.is-active .icn-h-menu .ihm-3 {
  -webkit-transform: rotate(-45deg) translate3d(0.34375rem, -0.34375rem, 0);
          transform: rotate(-45deg) translate3d(0.34375rem, -0.34375rem, 0);
}
JS
$(document).ready(function() {
  function close(){
        $(".h-menu").addClass('is-active');
    setTimeout(function(){
      init();
    },1000);
       
  }
  setTimeout(function(){
    close();
  },1000);
  function init(){
  $('.h-menu').on('click',
    function(){
      $(this).toggleClass('is-active');
  });
  
  $('.h-menu').hover(function(){
    $(this).addClass('is-hover');
  },function(){
    $(this).removeClass('is-hover');
  });
  
  $('.h-menu').on('mousedown',function(){
    $(this).addClass('is-mousedown');
  });
  
  $('.h-menu').on('mouseup',function(){
    $(this).removeClass('is-mousedown');
  });
  }
});
Host Instantly Drag and Drop Website Builder

 

Description

This is a transition sample of Hamburger menu icon to close button with CSS.
Term
Wed, 11/29/2017 - 11:20

Related Codes

Pen ID
Pen ID
Pen ID