Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <h3 id="menu-toggle">Menu</h3>
<ul id="menu">
  <li><a href="#">Home</a>
    <ul class="sub-menu">
      <li><a href="#">Test 1</a></li>
      <li><a href="#">Test 2</a></li>
  <li><a href="#">Products</a>
    <ul class="sub-menu">
      <li><a href="#">HTML</a></li>
      <li><a href="#">CSS</a></li>
      <li><a href="#">Javascript</a>
        <ul class="sub-menu">
          <li><a href="#">jQuery</a></li>
          <li><a href="#">MooTools</a></li>
  <li><a href="#">About</a></li>
  <li><a href="#">Contact</a></li>           


                #menu, .sub-menu {
  display: none;
  list-style: none;

/*Change toggle size by adjusting width & height*/
.tb-menu-toggle {
  border: 0;
  position: relative;
  background: transparent;
  cursor: pointer;

/*Change toggle color here*/
.tb-menu-toggle i {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 20%;
  -webkit-transition:all .2s;
   -moz-transition:all .2s;
     -o-transition:all .2s;
        transition:all .2s;
.tb-menu-toggle i:nth-child(2) {
  top: 40%;
.tb-menu-toggle i:nth-child(3) {
  top: 80%;

/* Style the active toggle here */
.tb-menu-toggle.tb-active-toggle i {  }

/*Animation of the toggle*/
.tb-menu-toggle.tb-animate-toggle i:first-child,
.tb-menu-toggle.tb-animate-toggle i:nth-child(2){ 
  top: 40%;
.tb-menu-toggle.tb-animate-toggle i:nth-child(3){ 
  top: 40%;


  // Define the threeBarToggle function by extending the jQuery object
  threeBarToggle: function(options){
    // Set the default options
    var defaults = {
      color: 'black',
      width: 30,
      height: 25,
      speed: 400,
      animate: true
    var options = $.extend(defaults, options); 
    return this.each(function(){
      $(this).empty().css({'width': options.width, 'height': options.height, 'background': 'transparent'});
      $(this).prepend('<i></i><i></i><i></i>').on('click', function(event) {
        if (options.animate) { $(this).toggleClass('tb-animate-toggle'); }
      $(this).children().css('background', options.color);
  // Define the accordionMenu() function that adds the sliding functionality
  accordionMenu: function(options){
    // Set the default options
    var defaults = {
      speed: 400
    var options =  $.extend(defaults, options);

    return this.each(function(){
      var menuItems = $(this).children('li');
      $('.tb-parent ul').hide();
      $('.tb-parent > a').on('click', function(event) {

// Convert any element into a three bar toggle
// Optional arguments are 'speed' (number in ms, 'slow' or 'fast') and 'animation' (true or false) to disable the animation on the toggle
$('#menu-toggle').threeBarToggle({color: 'green', width: 30, height: 25});

// Make any nested ul-based menu mobile
// Optional arguments are 'speed' and 'accordion' (true or false) to disable the behavior of closing other sub