HAMBERGER BUTTON GENERATOR

ボタンの設定

  • 横幅

    px
  • 縦幅

    px
  • 線幅

    px
  • カラー

    #
  • 45度で固定

凡例

生成されたボタン

HTML

<button type="button" class="zdo_drawer_button">
  <span class="zdo_drawer_bar zdo_drawer_bar1"></span>
  <span class="zdo_drawer_bar zdo_drawer_bar2"></span>
  <span class="zdo_drawer_bar zdo_drawer_bar3"></span>
  <span class="zdo_drawer_menu_text zdo_drawer_text">MENU</span>
  <span class="zdo_drawer_close zdo_drawer_text">CLOSE</span>
</button>

CSS

/* ===============
This humberger button was generated by Zarigani Design Office Humberger Button Generator.

Zarigani Design Office's Hamberger Button 
Copyright: 2019 Zarigani Design Office
URL: https://zarigani-design-office.com/hamberger/
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
================*/

/*+++ Reset +++*/
.zdo_drawer_button * {
  margin: 0;
  padding: 0;
  outline: none;
  border: none;
  font: inherit;
  font-family: inherit;
  font-size: 100%;
  font-style: inherit;
  font-weight: inherit;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  text-align: left;
  text-decoration: none;
  list-style: none;
}

.zdo_drawer_button {
  display: block;
  padding: 0;
  width: {{button_width}}px;
  height: {{button_height}}px;
  position: relative;
  background: none;
  border: none;
  text-align: center;
  letter-spacing: 0.1em;
  cursor: pointer;
  outline: none;
}

.zdo_drawer_button .zdo_drawer_bar {
  display: block;
  width: {{button_width}}px;
  height: {{button_line_width}}px;
  transition: all 0.2s;
  transform-origin: 0% 0%;
  transform: translateY(-50%);
  position: absolute;
  left: 0;
}

.zdo_drawer_button .zdo_drawer_bar1 {
  top: 0;
}

.zdo_drawer_button .zdo_drawer_bar2 {
  top: 50%;
}

.zdo_drawer_button .zdo_drawer_bar3 {
  top: 100%;
}

.zdo_drawer_button.active .zdo_drawer_bar {
  width: {{button_active_width}};
  left: {{left1}}
}

.zdo_drawer_button.active .zdo_drawer_bar1 {
  transform: rotate({{button_degree}}deg) translateY(-50%);
  top: {{top_active1}}
}

.zdo_drawer_button.active .zdo_drawer_bar2 {
  opacity: 0;
}

.zdo_drawer_button.active .zdo_drawer_bar3 {
  transform: rotate(-{{button_degree}}deg) translateY(-50%);
  top: {{top_active2}}
}

.zdo_drawer_button.active .zdo_drawer_menu_text {
  display: none;
}

.zdo_drawer_button.active .zdo_drawer_close {
  display: block;
}

.zdo_drawer_text {
  width: 100%;
  position: absolute;
  bottom: -20px;
  left: 0;
  text-align: center;
  font-size: 10px;
}

.zdo_drawer_close {
  letter-spacing: 0.08em;
  display: none;
}

/*+++ Default Button Color +++*/
  .zdo_drawer_button {
  color: #{{color}};
}

.zdo_drawer_button .zdo_drawer_bar {
  background-color: #{{color}};
}

jQuery

$(function () {
  $('.zdo_drawer_button').click(function () {
    $(this).toggleClass('active');
  })
})