Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- ハンバーガーメニュー -->
<div class="hamburger-position">
    <div class="hamburger">
        <span class="hamburger-top-bar"></span>
        <span class="hamburger-middle-bar"></span>
        <span class="hamburger-bottom-bar"></span>
    </div>
</div>
              
            
!

CSS

              
                @charset "utf-8";

/*---------------------------
ハンバーガーメニュー
---------------------------*/

/*
コメントがあるところで細かく設定できます!
コメントなしのCSSはさわらないでください!
*/

.hamburger-position {
    position: fixed;
    top: 10px;
    right: 10px;
}

.hamburger {
    width: 100px; /* 横幅設定 */
    height: 100px; /* 高さ設定 */
    cursor: pointer;
    position: relative;
}

/* バーの共通設定 */
.hamburger span {
    width: 100%;
    height: 10%; /* ハンバーガーメニューのバーの太さ設定 */
    position: absolute;
    background: #333; /* 三本線の時の色 */
    transition: all 0.3s; /* 三本線の状態からXになるまでの時間設定 */
}

/* バーの初期位置 */
.hamburger-top-bar {
    top: 0px;
}
.hamburger-middle-bar {
    top: 50%;
    transform: translateY(-50%);
}
.hamburger-bottom-bar {
    bottom: 0px;
}

/* active付与時 トップバー */
.hamburger.active .hamburger-top-bar {
    top: 50%;
    transform: translateY(-50%);
    background :#333; /* Xの時の色 */
    transform: rotate(405deg); /* 回転設定 45 or 765に変更可 */
}

/* active付与時 ミドルバー */
.hamburger.active .hamburger-middle-bar {
    opacity: 0;
}

/* active付与時 ボトムバー */
.hamburger.active .hamburger-bottom-bar {
    top: 50%;
    transform: translateY(-50%);
    background: #333; /* Xの時の色 */
    transform: rotate(-405deg); /* 回転設定 -45 or -765に変更可 */
}

/*---------------------------
ハンバーガーメニューここまで
---------------------------*/
              
            
!

JS

              
                $(function(){ 
  // ハンバーガーメニューをクリックするとactiveクラスが付与される
  $(".hamburger").click(function(){
  $(this).toggleClass("active");
  });
});
              
            
!
999px

Console