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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                html(lang='en')
  head
    meta(charset='utf-8')
    meta(name='viewport', content='width=device-width, initial-scale=1, maximum-scale=1')
    title jQuery Accordion Menu 
    link(href='https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', rel='stylesheet')
    script(type='text/javascript', src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js')
  body
    .content
      .colors
        //a.default(href='javascript:void(0)')  
        //a.blue(href='javascript:void(0)')  
        //a.white(href='javascript:void(0)')
      nav
        #menu.menu
          .menu-header  MENU 
          ul
            li.active
              a(href='#')
                i.fa.fa-home  
                |Home
            li
              a(href='#')
                i.fa.fa-file-image-o  
                | Web Development
              ul.submenu
                li
                  a(href='#')  HTML/CSS
                li
                  a(href='#')  Javascript
            li
              a(href='#')
                i.fa.fa-cog  
                |Services
              ul.submenu
                li
                  a(href='#')  Web Design 
                  ul.submenu
                    li
                      a(href='#')  Graphics
                    li
                      a(href='#')  Photoshop
                li
                  a(href='#')  Hosting
                li
                  a(href='#')  Design 
                li
                  a(href='#')  Consulting 
            li
              a(href='#')
                i.fa.fa-newspaper-o  
                |News
                span.menu-label  8 
            li
              a(href='#')
                i.fa.fa-user  
                |About
            li
              a(href='#')
                i.fa.fa-envelope  
                |  Contact
          .menu-footer  @ Test

              
            
!

CSS

              
                // Mixin
.keyframes(@name; @arguments) {
  @-moz-keyframes @name { @arguments(); }
  @-webkit-keyframes @name { @arguments(); }
  @keyframes @name { @arguments(); }
}
.transition(@value) {
  -moz-transition: @value;
  -o-transition: @value;
  -webkit-transition: @value;
  transition: @value;
}
.transform(@value) {
  -moz-transform: @value;
  -ms-transform: @value;
  -o-transform: @value;
  -webkit-transform: @value;
  transform: @value;
}
// Color variables
@color0: #f0f0f0;
@color1: #ffffff;
@color2: #414956;
@color3: #555555;
@color4: #3e82da;
@color5: #049372;
@color6: #222222;
@color7: #292929;
@color8: #03a678;
@color9: #da4453;
@color10: #ed5565;
@color11: #4a89dc;
@color12: #3b424d;

// Width variables
@width1: 260px;
@width2: 20px;
@width3: 100%;

// Height variables
@height0: 50px;

* {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
body {
  background: @color0;
}
.content {
  margin: 100px auto;
  width: @width1;
}
.colors {
  float: left;
  margin: 20px auto;
  width: @width1;
  a {
    float: left;
    height: 30px;
    width: 100%/3;
  }
  .default {
    background: @color2;
  }
  .blue {
    background: @color11;
  }
  .white {
    background: @color1;
  }
}
.menu {
  box-shadow: 0 20px 50px #333333;
  float: left;
  font-family: 'Open Sans', sans-serif;
  min-width: @width1;
  outline: 0;
  position: relative;
  * {
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    font-family: 'Open Sans', sans-serif;
    outline: 0;
  }
  .menu-footer {
    background: @color2;
    color: @color0;
    float: left;
    font-weight: normal;
    height: @height0;
    line-height: @height0;
    font-size: 6px;
    width: @width3;
    text-align: center;
  }
  .menu-header {
    background: @color2;
    color: @color0;
    font-weight: bold;
    height: @height0;
    line-height: @height0;
    text-align: center;
    width: @width3;
  }
  ul {
    list-style: none;
    margin: 0;
    padding: 0;
    li {
      display: block;
      float: left;
      position: relative;
      width: @width3;
      a {
        background: @color2;
        color: @color0;
        float: left;
        font-size: 13px;
        overflow: hidden;
        padding: 14px 22px;
        position: relative;
        text-decoration: none;
        white-space: nowrap;
        width: @width3;
        i {
          float: left;
          font-size: 16px;
          line-height: 18px;
          text-align: left;
          width: 34px;
        }
      }
      .menu-label {
        background: @color0;
        border-radius: 100%;
        color: @color3;
        font-size: 11px;
        font-weight: 800;
        line-height: 18px;
        min-width: @width2;
        padding: 1px 2px 1px 1px;
        position: absolute;
        right: 18px;
        text-align: center;
        top: 14px;
      }
    }
    .submenu {
      display: none;
      position: static;
      width: @width3;
      .submenu-indicator {
        line-height: 16px;
      }
      li {
        clear: both;
        width: @width3;
        ul.submenu {
          display: none;
          position: static;
          width: @width3;
          overflow: hidden;
        }
        a {
          background: #383838;
          border-left: solid 6px transparent;
          border-top: none;
          float: left;
          font-size: 11px;
          position: relative;
          width: @width3;
        }
        &:hover>a {
          border-left-color: @color2;
        }
        .menu-label {
          background: @color0;
          border-radius: 100%;
          color: @color3;
          font-size: 11px;
          font-weight: 800;
          line-height: 18px;
          min-width: @width2;
          padding: 1px 2px 1px 1px;
          position: absolute;
          right: 18px;
          text-align: center;
          top: 12px;
          top: 14px;
        }
      }
    }
    .submenu>li>a {
      padding-left: 30px;
    }
    .submenu>li>ul.submenu>li>a {
      padding-left: 45px;
    }
    .submenu>li>ul.submenu>li>ul.submenu>li>a {
      padding-left: 60px;
    }
  }
  .submenu-indicator {
    .transition("transform .3s linear");
    float: right;
    font-size: 20px;
    line-height: 19px;
    position: absolute;
    right: 22px;
  }
  .submenu-indicator-minus>.submenu-indicator {
    .transform(rotate(45deg));
  }
}
.menu>ul>li.active>a {
  background: @color12;
  color: @color1;
}
.menu>ul>li {
  &:hover>a {
    background: @color12;
    color: @color1;
  }
}
.menu>ul>li>a {
  border-bottom: solid 1px @color12;
}
.ink {
  .transform(scale(0));
  background: rgba(255, 255, 255, .3);
  border-radius: 100%;
  display: block;
  position: absolute;
  transform: scale(0);
}
.animate-ink {
  -moz-animation: ripple .3s linear;
  -ms-animation: ripple .3s linear;
  -o-animation: ripple .3s linear;
  -webkit-animation: ripple .3s linear;
  animation: ripple .3s linear;
}

.keyframes('ripple', 
  {
    100% {
    opacity: 0;
    transform: scale(2.5)
    }
  });

.blue.menu {
  .menu-footer {
    background: @color11;
  }
  .menu-header {
    background: @color11;
  }
  ul {
    li {
      >a {
        background: @color11;
      }
    }
    ul.submenu {
      li {
        &:hover>a {
          border-left-color: @color4;
        }
      }
    }
  }
}
.blue.menu>ul>li.active>a {
  background: @color4;
}
.blue.menu>ul>li {
  &:hover>a {
    background: @color4;
  }
}
.blue.menu>ul>li>a {
  border-bottom-color: @color4;
}

.white.menu {
  .menu-footer {
    background: @color1;
    color: @color3;
  }
  .menu-header {
    background: @color1;
    color: @color3;
  }
  ul {
    li {
      a {
        background: @color1;
        color: @color3;
      }
    }
    ul.submenu {
      li {
        &:hover>a {
          border-left-color: @color0;
        }
        a {
          color: @color0;
        }
      }
    }
  }
}
.white.menu>ul>li.active>a {
  background: @color0;
}
.white.menu>ul>li {
  &:hover>a {
    background: @color0;
  }
}
.white.menu>ul>li>a {
  border-bottom-color: @color0;
}
.white.menu>ul>li>a>.ink {
  background: rgba(0, 0, 0, .1);
}
              
            
!

JS

              
                jQuery(document).ready(function($) {
  $("#menu").accordion();
  $(".colors a").click(function() {
    if ($(this).attr("class") != "default") {
      $("#menu").removeClass();
      $("#menu").addClass("menu").addClass($(this).attr("class"));
    } else {
      $("#menu").removeClass();
      $("#menu").addClass("menu");
    }
  });
});

/* accordion menu plugin*/
;(function($, window, document, undefined) {
  var pluginName = "accordion";
  var defaults = {
    speed: 200,
    showDelay: 0,
    hideDelay: 0,
    singleOpen: true,
    clickEffect: true,
    indicator: 'submenu-indicator-minus',
    subMenu: 'submenu',
    event: 'click touchstart' // click, touchstart
  };

  function Plugin(element, options) {
    this.element = element;
    this.settings = $.extend({}, defaults, options);
    this._defaults = defaults;
    this._name = pluginName;
    this.init();
  }
  $.extend(Plugin.prototype, {
    init: function() {
      this.openSubmenu();
      this.submenuIndicators();
      /*if (defaults.clickEffect) {
        this.addClickEffect();
      }*/
    },
    openSubmenu: function() {
      $(this.element).children("ul").find("li").bind(defaults.event, function(e) {
        e.preventDefault();
        e.stopPropagation();
        var $subMenus = $(this).children("." + defaults.subMenu);
        var $allSubMenus = $(this).find("." + defaults.subMenu);
        if ($subMenus.length > 0) {
          if ($subMenus.css("display") == "none") {
            $subMenus.slideDown(defaults.speed).siblings("a").addClass(defaults.indicator);
            if (defaults.singleOpen) {
              $(this).siblings().find("." + defaults.subMenu).slideUp(defaults.speed)
                .end().find("a").removeClass(defaults.indicator);
            }
            return false;
          } else {
            $(this).find("." + defaults.subMenu).delay(defaults.hideDelay).slideUp(defaults.speed);
          }
          if ($allSubMenus.siblings("a").hasClass(defaults.indicator)) {
            $allSubMenus.siblings("a").removeClass(defaults.indicator);
          }
        }
        window.location.href = $(this).children("a").attr("href");
      });
    },
    submenuIndicators: function() {
      if ($(this.element).find("." + defaults.subMenu).length > 0) {
        $(this.element).find("." + defaults.subMenu).siblings("a").append("<span class='submenu-indicator'>+</span>");
      }
    },
    addClickEffect: function() {
      var ink, d, x, y;
      $(this.element).find("a").bind("click touchstart", function(e) {
        $(".ink").remove();
        if ($(this).children(".ink").length === 0) {
          $(this).prepend("<span class='ink'></span>");
        }
        ink = $(this).find(".ink");
        ink.removeClass("animate-ink");
        if (!ink.height() && !ink.width()) {
          d = Math.max($(this).outerWidth(), $(this).outerHeight());
          ink.css({
            height: d,
            width: d
          });
        }
        x = e.pageX - $(this).offset().left - ink.width() / 2;
        y = e.pageY - $(this).offset().top - ink.height() / 2;
        ink.css({
          top: y + 'px',
          left: x + 'px'
        }).addClass("animate-ink");
      });
    }
  });
  $.fn[pluginName] = function(options) {
    this.each(function() {
      if (!$.data(this, "plugin_" + pluginName)) {
        $.data(this, "plugin_" + pluginName, new Plugin(this, options));
      }
    });
    return this;
  };
})(jQuery, window, document);
              
            
!
999px

Console