LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code



  

  

  Eva Lettner || Web Design & Development






Menu Transitions Gallery

Simple burger menus that don't move are boring. As a user, I want to engage with a site and discover new things. This is the main reason I came up with a couple of simple CSS transitions to make the whole process more fun. Click away!

CSS
body {
  background-color: #B56C8A;
  height: 100%;
  font-family: "Raleway", sans-serif;
  color: #F8FFE9;
  font-size: 16px;
  line-height: 1.8rem;
  margin: 0;
}

.burgers {
  margin: 0 auto;
  width: 80%;
  text-align: center;
}

h1 {
  font-family: "Bitter", serif;
  font-size: 25px;
  font-weight: 400;
  text-align: center;
  padding: 40px;
}

h2 {
  font-family: "Bitter", serif;
  font-size: 30px;
  font-weight: 400;
  text-align: center;
  margin-top: 80px;
  margin-bottom: 10px;
}

.container {
  width: 90%;
  margin: 0 auto;
}

.icon {
  height: 14px;
  width: 80px;
  top: 30px;
  background-color: #F8FFE9;
  border-radius: 20px;
  position: absolute;
  transition-duration: 0.5s;
}
.icon:before {
  left: 0;
  position: absolute;
  top: -25px;
  height: 14px;
  width: 80px;
  background-color: #F8FFE9;
  content: "";
  border-radius: 20px;
  transition-duration: 0.5s;
}
.icon:after {
  left: 0;
  position: absolute;
  top: 25px;
  height: 14px;
  width: 80px;
  background-color: #F8FFE9;
  content: "";
  border-radius: 20px;
  transition-duration: 0.5s;
}

.menu {
  width: 80px;
  height: 80px;
  position: relative;
  transition-duration: 1s;
  display: inline-block;
  margin: 40px;
  cursor: pointer;
}

.burger1-open {
  transform: rotateZ(450deg);
}

.burger2 .icon {
  transition-duration: 0.5s;
  transition-delay: 0.5s;
}
.burger2 .icon:after {
  transition: transform 0.5s, top 0.5s 0.5s;
}
.burger2 .icon:before {
  transition: transform 0.5s, top 0.5s 0.5s;
}

.burger2.open .icon {
  transition-duration: 0.1s;
  transition-delay: 0.5s;
  background: transparent;
}

.burger2.open .icon:before {
  transition: top 0.5s, transform 0.5s 0.5s;
  top: 0px;
  transform: rotateZ(-45deg);
}

.burger2.open .icon:after {
  transition: top 0.4s, transform 0.5s 0.5s;
  top: 0px;
  transform: rotateZ(45deg);
}

.burger3.open .icon {
  background: transparent;
}

.burger3.open .icon:before {
  transition: transform 0.5s;
  transform: rotateZ(45deg) translate(15px, 20px);
}

.burger3.open .icon:after {
  transition: transform 0.5s;
  transform: rotateZ(-405deg) translate(15px, -20px);
}
JS
$(document).ready(function(){
    $(".burger1").click(function(){
        $(".burger1").toggleClass("burger1-open");
    })

    $(".burger2").click(function(){
      $(".burger2").toggleClass("open");
    })

    $(".burger3").click(function(){
      $(".burger3").toggleClass("open");
    })
})
Host Instantly Drag and Drop Website Builder

 

Description

css transitions only and super simple
Term
Mon, 11/27/2017 - 22:07

Related Codes

Pen ID
Pen ID
Pen ID