Chapter.6JavaScript(jQuery)基礎

-- css --
header .box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  padding: 20px 0;
}
header .box ul {
  display: flex;
  align-items: center;
}
header .box ul a {
  position: relative;
  display: block;
  padding: 20px;
  font-size: 14px;
}
header .box ul a::before {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 10%;
  width: 80%;
  height: 2px;
  background: #333;
  opacity: 0;
  transition: 0.5s;
}
header .box ul a:hover::before {
  opacity: 1;
}
header .box .reserve a {
  display: block;
  margin-left: 20px;
  padding: 20px 30px;
  color: #fff;
  background: #333;
  transition: 0.5s;
}
header .box .reserve a:hover {
  background: #999;
}
header .box ul .reserve a::before {
  display: none;
}

#hamburger {
  position: fixed;
  display: none;
  width: 44px;
  height: 44px;
  top: 20px;
  right: 20px;
  background: #eee;
  cursor: pointer;
  z-index: 99;
}
#hamburger span {
  position: absolute;
  width: 30px;
  height: 2px;
  left: 7px;
  background: #000;
  transition: .5s;
}
#hamburger .top {
  top: 11px;
}
#hamburger .middle {
  top: 21px;
}
#hamburger .bottom {
  top: 31px;
}
#hamburger.active .top {
  transform: translateY(11px) rotate(45deg);
}
#hamburger.active .middle {
  opacity: 0;
}
#hamburger.active .bottom {
  transform: translateY(-9px) rotate(-45deg);
}

@media screen and (max-width: 1000px) {
  header .box ul a:hover::before {
    display: none;
  }
  #overlay {
    position: fixed;
    top: 0;
    right: -80%;
    width: 80%;
    height: 100%;
    background: #aaa;
    opacity: 0;
    transition: .5s;
    overflow-y:scroll;
    z-index: 98;
  }
  #hamburger {
    display: block;
  }
  #overlay.active {
    right: 0;
    opacity: 1;
  }
  #overlay nav {
    padding: 100px 0 50px;
  }
  header .box ul {
    display: block;
  }
  #overlay nav a {
    display: block;
    padding: 20px 40px;
    color: #fff;
    font-size: 31px;
    line-height: 2em;
  }
  header .box nav .reserve a {
    margin-left: 0;
    padding: 20px 40px;
    color: #fff;
    background: none;
    transition: ;
  }
  header .box nav .reserve a:hover {
    background: none;
  }
}