Curtain Menu

By Rafi

F6
#
How do I use This?

Full screen overlay menu that features some smooth transitions.

HTML
<!-- the trigger -->
<div class="curtain-menu-button" data-curtain-menu-button>
  <div class="curtain-menu-button-toggle">
    <div class="bar1"></div>
    <div class="bar2"></div>
  </div>
</div>

<!-- the menu  -->
<div class="curtain-menu">
  <div class="curtain"></div>
  <div class="curtain"></div>
  <div class="curtain"></div>
  <div class="curtain-menu-wrapper">
    <ul class="curtain-menu-list menu vertical">
      <li><a href="#">Home</a></li>
      <li><a href="#">About</a></li>
      <li><a href="#">Work</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
  </div>
</div>

$curtain-menu-color: $primary-color;
$curtain-menu-text-color: $white;
$curtain-menu-font-size: rem-calc(45);
$curtain-menu-button-size: rem-calc(40);

.curtain-menu {
  z-index: 2;
  position: relative;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  pointer-events: none;
}

.curtain-menu-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  height: 100vh;
  width: 100vw;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  transform: translateY(-100%);
  transition: transform 0.5s;
  transition-delay: 0.5s;
  visibility: hidden;

  .curtain-menu-list {
    li {
      width: 100%;
      font-weight: 100;
      font-size: $curtain-menu-font-size;
      min-height: $curtain-menu-font-size;
      padding: 1rem;
      text-align: center;
      justify-content: center;
      transition: all 0.2s ease-in;

      &:hover {
        background: rgba($white, 0.7);

        a {
          color: $curtain-menu-color;
        }
      }

      a {
        color: $curtain-menu-text-color;
        justify-content: center;
      }
    }
  }
}

.curtain-menu .curtain {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: flex 0.45s;

  &:nth-child(2) {
    flex:1 0 100%;
    background: transparent;
  }

  &:nth-child(odd){
    background: darken($curtain-menu-color, 20%);
  }
}

.curtain-menu-button {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 5;
}

.curtain-menu-button-toggle {
  width: $curtain-menu-button-size;
  height: $curtain-menu-button-size;
  border-radius: 5000px;
  background: $curtain-menu-text-color;
  position: relative;
  box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
  cursor: pointer;

  div {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 3px;
    background: $curtain-menu-color;
    transition: transform 0.3s;
    transition-delay: 0.5s;
  }

  .bar1{
    transform: translateX(-50%)translateY(-50%)rotate(-90deg);
  }

  .bar2{
    transform: translateX(-50%)translateY(-50%)rotate(-180deg);
  }

  &:hover {
    background: $curtain-menu-color;

    div{
      background: $curtain-menu-text-color;
    }
  }

  &:active {
    box-shadow: none;
  }
}

.curtain-menu-open {
  .curtain:nth-child(2) {
    flex: 0 0 0%;
  }

  .curtain-menu-wrapper {
    transform: translateY(0%);
    visibility: visible;
    pointer-events:all;
  }

 .curtain-menu-button-toggle {
    .bar1{
      transform: translateX(-50%)translateY(-50%)rotate(-45deg);
    }

    .bar2{
      transform: translateX(-50%)translateY(-50%)rotate(-135deg);
    }
  }
}






.curtain-menu {
  z-index: 2;
  position: relative;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: stretch;
      -ms-flex-align: stretch;
          align-items: stretch;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  pointer-events: none;
}

.curtain-menu-wrapper {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  position: absolute;
  height: 100vh;
  width: 100vw;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  -webkit-transform: translateY(-100%);
      -ms-transform: translateY(-100%);
          transform: translateY(-100%);
  transition: -webkit-transform 0.5s;
  transition: transform 0.5s;
  transition: transform 0.5s, -webkit-transform 0.5s;
  transition-delay: 0.5s;
  visibility: hidden;
}

.curtain-menu-wrapper .curtain-menu-list li {
  width: 100%;
  font-weight: 100;
  font-size: 2.8125rem;
  min-height: 2.8125rem;
  padding: 1rem;
  text-align: center;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
  transition: all 0.2s ease-in;
}

.curtain-menu-wrapper .curtain-menu-list li:hover {
  background: rgba(254, 254, 254, 0.7);
}

.curtain-menu-wrapper .curtain-menu-list li:hover a {
  color: #1779ba;
}

.curtain-menu-wrapper .curtain-menu-list li a {
  color: #fefefe;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
}

.curtain-menu .curtain {
  -webkit-flex: 1;
      -ms-flex: 1;
          flex: 1;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  transition: -webkit-flex 0.45s;
  transition: flex 0.45s;
  transition: flex 0.45s, -webkit-flex 0.45s, -ms-flex 0.45s;
}

.curtain-menu .curtain:nth-child(2) {
  -webkit-flex: 1 0 100%;
      -ms-flex: 1 0 100%;
          flex: 1 0 100%;
  background: transparent;
}

.curtain-menu .curtain:nth-child(odd) {
  background: #0c3e5f;
}

.curtain-menu-button {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 5;
}

.curtain-menu-button-toggle {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 5000px;
  background: #fefefe;
  position: relative;
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.curtain-menu-button-toggle div {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 3px;
  background: #1779ba;
  transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
  transition: transform 0.3s, -webkit-transform 0.3s;
  transition-delay: 0.5s;
}

.curtain-menu-button-toggle .bar1 {
  -webkit-transform: translateX(-50%) translateY(-50%) rotate(-90deg);
      -ms-transform: translateX(-50%) translateY(-50%) rotate(-90deg);
          transform: translateX(-50%) translateY(-50%) rotate(-90deg);
}

.curtain-menu-button-toggle .bar2 {
  -webkit-transform: translateX(-50%) translateY(-50%) rotate(-180deg);
      -ms-transform: translateX(-50%) translateY(-50%) rotate(-180deg);
          transform: translateX(-50%) translateY(-50%) rotate(-180deg);
}

.curtain-menu-button-toggle:hover {
  background: #1779ba;
}

.curtain-menu-button-toggle:hover div {
  background: #fefefe;
}

.curtain-menu-button-toggle:active {
  box-shadow: none;
}

.curtain-menu-open .curtain:nth-child(2) {
  -webkit-flex: 0 0 0%;
      -ms-flex: 0 0 0%;
          flex: 0 0 0%;
}

.curtain-menu-open .curtain-menu-wrapper {
  -webkit-transform: translateY(0%);
      -ms-transform: translateY(0%);
          transform: translateY(0%);
  visibility: visible;
  pointer-events: all;
}

.curtain-menu-open .curtain-menu-button-toggle .bar1 {
  -webkit-transform: translateX(-50%) translateY(-50%) rotate(-45deg);
      -ms-transform: translateX(-50%) translateY(-50%) rotate(-45deg);
          transform: translateX(-50%) translateY(-50%) rotate(-45deg);
}

.curtain-menu-open .curtain-menu-button-toggle .bar2 {
  -webkit-transform: translateX(-50%) translateY(-50%) rotate(-135deg);
      -ms-transform: translateX(-50%) translateY(-50%) rotate(-135deg);
          transform: translateX(-50%) translateY(-50%) rotate(-135deg);
}

JS
$('[data-curtain-menu-button]').click(function(){
  $('body').toggleClass('curtain-menu-open');
})