Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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

              
                  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="sample.css" type="text/css">
    <script type="text/javascript" src="http://code.jquery.com/jquery-2.2.3.min.js"></script>
    <script src="sample.js" type="text/javascript"></script>
    <title>jQuery</title>
  </head>
  <body>
    <!-- slideToggle -->
    <div id="sample01">
      <dl id="acMenu">
        <dt>アコーディオンメニュー</dt>
          <dd>openメニュー</dd>
        <dt>アコーディオンメニュー</dt>
          <dd>openメニュー</dd>
        <dt>アコーディオンメニュー</dt>
          <dd>openメニュー</dd>
      </dl>
    </div>
    <!-- fadeToggle -->
    <div id="sample02">
      <ul id="tabMenu" class="clearfix">
        <li><a href="#tabBox1">メニュー1</a></li>
        <li><a href="#tabBox2">メニュー2</a></li>
        <li><a href="#tabBox3">メニュー3</a></li>
      </ul>
      <div id="tabBoxes">
        <div id="tabBox1">ボックス1</div>
        <div id="tabBox2">ボックス2</div>
        <div id="tabBox3">ボックス3</div>
      </div>
    </div>
    <!-- toggleClass -->
    <div>
      <dl id="acMenu2">
        <dt>アコーディオンメニュー</dt>
          <dd>openメニュー</dd>
        <dt>アコーディオンメニュー</dt>
          <dd>openメニュー</dd>
        <dt>アコーディオンメニュー</dt>
          <dd>openメニュー</dd>
      </dl>
    </div>
  </body>
              
            
!

CSS

              
                #acMenu dt{
  display:block;
  width:200px;
  height:50px;
  line-height:50px;
  text-align:center;
  border:#5bc0de 1px solid;
  cursor:pointer;
 }

#acMenu dd{
  background:#d9534f;
  width:200px;
  height:50px;
  line-height:50px;
  text-align:center;
  border:#5bc0de 1px solid;
  display:none;
}

#tabMenu ul{
  width:600px;
}

#tabMenu li{
  float:left;
}

#tabMenu li a{
  display:block;
  width:198px;
  height:48px;
  line-height:50px;
  text-align:center;
  border:#5bc0de 1px solid;
}

#tabBox1,#tabBox2,#tabBox3{
  width:598px;
  height:300px;
  border:#5bc0de 1px solid;
}

#tabBox1{
  background:#5bc0de;
}

#tabBox2{
  background:#d9534f;
  display:none;
}

#tabBox3{
  background:#115a71;
  display:none;
}

#acMenu2 dt{
  display:block;
  width:185px;
  height:50px;
  line-height:50px;
  text-align:center;
  border:#5bc0de 1px solid;
  cursor:pointer;
  padding-right:15px;
}

#acMenu2 dd{
  background:#5bc0de;
  width:200px;
  height:50px;
  line-height:50px;
  text-align:center;
  border:#5bc0de 1px solid;
  display:none;
}

#acMenu2 dt.active{}

div{
  padding-left: 20px;
  height: 500px;
}
              
            
!

JS

              
                $(function(){
  $("#acMenu2 dt").on("click", function() {
    $(this).next().slideToggle();
    $(this).toggleClass("active");
  });
  $("#acMenu dt").on("click", function() {
    $(this).next().slideToggle();
  });
  $("#tabMenu li a").on("click", function() {
    $("#tabBoxes div").hide();
    $($(this).attr("href")).fadeToggle();
    return false;
  });
});
              
            
!
999px

Console