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

              
                <div class="content">
  <div id="jquery-accordion-menu" class="jquery-accordion-menu red">
    <div class="jquery-accordion-menu-header" id="form"></div>
    <ul id="demo-list">
      <li class="active"><a href="#"><i class="fa fa-home"></i>Home </a></li>
      <li><a href="#"><i class="fa fa-glass"></i>Events </a></li>
      <li><a href="#"><i class="fa fa-file-image-o"></i>Gallery </a><span class="jquery-accordion-menu-label">12 </span></li>
      <li><a href="#"><i class="fa fa-cog"></i>Services </a>
        <ul class="submenu">
          <li><a href="#">Web Design </a></li>
          <li><a href="#">Hosting </a></li>
          <li><a href="#">Design </a>
            <ul class="submenu">
              <li><a href="#">Graphics </a></li>
              <li><a href="#">Vectors </a></li>
              <li><a href="#">Photoshop </a></li>
              <li><a href="#">Fonts </a></li>
            </ul>
          </li>
          <li><a href="#">Consulting </a></li>
        </ul>
      </li>
      <li><a href="#"><i class="fa fa-home"></i>System </a></li>
      <li><a href="#"><i class="fa fa-suitcase"></i>Portfolio </a>
        <ul class="submenu">
          <li><a href="#">Web Design </a></li>
          <li><a href="#">Graphics </a><span class="jquery-accordion-menu-label">10 </span></li>
          <li><a href="#">Photoshop</a></li>
          <li><a href="#">Programming </a></li>
        </ul>
      </li>
      <li><a href="#"><i class="fa fa-user"></i>About </a></li>
      <li><a href="#"><i class="fa fa-envelope"></i>Contact </a></li>
    </ul>
    <div class="jquery-accordion-menu-footer">
      Footer
    </div>
  </div>
</div>
              
            
!

CSS

              
                @font-face {
  font-family: 'FontAwesome2';
  src: url('//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff') format('woff'),
url('//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/fonts/fontawesome-webfont.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

.fa {
  display: inline-block;
  font-family: FontAwesome2 !important;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  background: #f0f0f0;
}

.content {
  width: 260px;
  margin: 20px auto;
}

#demo-list a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.jquery-accordion-menu, .jquery-accordion-menu * {
  font-family: 'Open Sans', sans-serif;
  box-sizing: border-box;
  outline: 0;
}

.jquery-accordion-menu {
  min-width: 260px;
  float: left;
  position: relative;
  box-shadow: 0 20px 50px #333;
}

.jquery-accordion-menu .jquery-accordion-menu-footer, .jquery-accordion-menu .jquery-accordion-menu-header {
  width: 100%;
  height: 50px;
  padding-left: 22px;
  float: left;
  line-height: 50px;
  font-weight: 600;
  color: #f0f0f0;
  background: #414956;
}

.jquery-accordion-menu ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.jquery-accordion-menu ul li {
  width: 100%;
  display: block;
  float: left;
  position: relative;
}

.jquery-accordion-menu ul li a {
  width: 100%;
  padding: 14px 22px;
  float: left;
  text-decoration: none;
  color: #f0f0f0;
  font-size: 13px;
  background: #414956;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: color .2s linear, background .2s linear;
}

.jquery-accordion-menu>ul>li.active, .jquery-accordion-menu>ul>li:hover>a {
  color: #fff;
  background: #3b424d;
}

.jquery-accordion-menu>ul>li>a {
  border-bottom: solid 1px #3b424d;
}

.jquery-accordion-menu ul li a i {
  width: 34px;
  float: left;
  line-height: 18px;
  font-size: 16px;
  text-align: left;
}

.jquery-accordion-menu .submenu-indicator {
  float: right;
  right: 22px;
  position: absolute;
  line-height: 19px;
  font-size: 20px;
  transition: transform .3s linear;
}

.jquery-accordion-menu ul ul.submenu .submenu-indicator {
  line-height: 16px;
}

.jquery-accordion-menu .submenu-indicator-minus>.submenu-indicator {
  transform: rotate(45deg);
}

.jquery-accordion-menu ul ul.submenu, .jquery-accordion-menu ul ul.submenu li ul.submenu {
  width: 100%;
  display: none;
  position: static;
}

.jquery-accordion-menu ul ul.submenu li {
  clear:both;
  width: 100%;
}

.jquery-accordion-menu ul ul.submenu li a {
  width: 100%;
  float: left;
  font-size: 11px;
  background: #383838;
  border-top: none;
  position: relative;
  border-left: solid 6px transparent;
  transition: border .2s linear;
}

.jquery-accordion-menu ul ul.submenu li:hover>a {
  border-left-color: #414956;
}

.jquery-accordion-menu ul ul.submenu>li>a {
  padding-left: 30px;
}

.jquery-accordion-menu ul ul.submenu>li>ul.submenu>li>a {
  padding-left: 45px;
}

.jquery-accordion-menu ul ul.submenu>li>ul.submenu>li>ul.submenu>li>a {
  padding-left: 60px;
}

.jquery-accordion-menu ul li .jquery-accordion-menu-label, .jquery-accordion-menu ul ul.submenu li .jquery-accordion-menu-label {
  min-width: 20px;
  padding: 1px 2px 1px 1px;
  position: absolute;
  right: 18px;
  top: 14px;
  font-size: 11px;
  font-weight: 800;
  color: #555;
  text-align: center;
  line-height: 18px;
  background: #f0f0f0;
  border-radius: 100%;
}

.jquery-accordion-menu ul ul.submenu li .jquery-accordion-menu-label {
  top: 12px;
}

.ink {
  display: block;
  position: absolute;
  background: rgba(255,255,255,.3);
  border-radius: 100%;
  transform: scale(0);
}

.animate-ink {
  animation: ripple .5s linear;
}

@keyframes ripple {
  100% {
    opacity: 0;
    transform: scale(2.5);
  }
}

.red.jquery-accordion-menu .jquery-accordion-menu-footer,.red.jquery-accordion-menu .jquery-accordion-menu-header,.red.jquery-accordion-menu ul li a {
	background: #ED5565
}

.red.jquery-accordion-menu>ul>li.active>a,.red.jquery-accordion-menu>ul>li:hover>a {
	background: #DA4453
}

.red.jquery-accordion-menu>ul>li>a {
	border-bottom-color: #DA4453
}

.red.jquery-accordion-menu ul ul.submenu li:hover>a {
	border-left-color: #DA4453
}
              
            
!

JS

              
                ;(function($, window, document, undefined) {
  var pluginName = "jqueryAccordionMenu";
  var defaults = {
    speed: 300,
    showDelay: 0,
    hideDelay: 0,
    singleOpen: true,
    clickEffect: true
  };
  
  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('click touchstart', function(e) {
        e.stopPropagation();
        e.preventDefault();
        if ($(this).children('.submenu').length > 0) {
          if ($(this).children('.submenu').css('display') == 'none') {
            $(this).children('.submenu').delay(defaults.showDelay).slideDown(defaults.speed);
            $(this).children('.submenu').siblings('a').addClass('submenu-indicator-minus');
            if (defaults.singleOpen) {
              $(this).siblings().children('.submenu').slideUp(defaults.speed);
              $(this).siblings().children('.submenu').siblings('a').removeClass('submenu-indicator-minus');
            }
            return false;
          } else {
            $(this).children('.submenu').delay(defaults.hideDelay).slideUp(defaults.speed);
          }
          
          if ($(this).children('.submenu').siblings('a').hasClass('submenu-indicator-minus')) {
            $(this).children('.submenu').siblings('a').removeClass('submenu-indicator-minus');
          }
        }
        window.location.href = $(this).children('a').attr('href');
      })
    },
    submenuIndicators: function() {
      if ($(this.element).find('.submenu').length > 0) {
        $(this.element).find('.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);

jQuery('#jquery-accordion-menu').jqueryAccordionMenu();
              
            
!
999px

Console