Jquery Vertical Accordion With Drop Down Collapse Menu Plugin

Accordion is a simple, clean, smooth, and SEO-friendly accordion menu plugin built with jQuery, CSS/CSS3, nested HTML menus, and the iconic Font Awesome.

vertical accordion menu bs 4, accordion menu with submenu, vertical accordion example, jquery accordion menu, accordion with drop down menu, left accordion menu

How to make use of it:

1. Download the necessary jQuery library and the iconic Font Awesome.

<link rel="stylesheet" href="/path/to/cdn/font-awesome/all.min.css" />
<script src="/path/to/cdn/jquery.min.js"></script>

2. Create the HTML structure for the accordion menu list.

<ul class="accordion-menu">
  <li>
    <div class="dropdownlink"><i class="fa fa-road" aria-hidden="true"></i> History
      <i class="fa fa-chevron-down" aria-hidden="true"></i>
    </div>
    <ul class="submenuItems">
      <li><a href="#">History 1</a></li>
      <li><a href="#">History 2</a></li>
      <li><a href="#">History 3</a></li>
    </ul>
  </li>
  <li>
    <div class="dropdownlink"><i class="fa fa-paper-plane" aria-hidden="true"></i> Fiction
      <i class="fa fa-chevron-down" aria-hidden="true"></i>
    </div>
    <ul class="submenuItems">
      <li><a href="#">Fiction 1</a></li>
      <li><a href="#">Fiction 2</a></li>
      <li><a href="#">Fiction 3</a></li>
    </ul>
  </li>
  <li>
    <div class="dropdownlink"><i class="fa fa-quote-left" aria-hidden="true"></i> Fantasy
      <i class="fa fa-chevron-down" aria-hidden="true"></i>
    </div>
    <ul class="submenuItems">
      <li><a href="#">Fantasy 1</a></li>
      <li><a href="#">Fantasy 2</a></li>
      <li><a href="#">Fantasy 3</a></li>
    </ul>
  </li>
  <li>
    <div class="dropdownlink"><i class="fa fa-motorcycle" aria-hidden="true"></i> Action
      <i class="fa fa-chevron-down" aria-hidden="true"></i>
    </div>
    <ul class="submenuItems">
      <li><a href="#">Action 1</a></li>
      <li><a href="#">Action 2</a></li>
      <li><a href="#">Action 3</a></li>
    </ul>
  </li>
</ul>

3. Necessary CSS Styles for Accordion Menu.

.accordion-menu {
  width: 100%;
  max-width: 350px;
  margin: 60px auto 20px;
  background: #fff;
  border-radius: 4px;
}

.accordion-menu li.open .dropdownlink {
  color: #cddc39;
}

.accordion-menu li.open .dropdownlink .fa-chevron-down {
  transform: rotate(180deg);
}

.accordion-menu li:last-child .dropdownlink {
  border-bottom: 0;
}

.dropdownlink {
  cursor: pointer;
  display: block;
  padding: 15px 15px 15px 45px;
  font-size: 18px;
  border-bottom: 1px solid #ccc;
  color: #212121;
  position: relative;
  transition: all 0.4s ease-out;
}

.dropdownlink i {
  position: absolute;
  top: 17px;
  left: 16px;
}

.dropdownlink .fa-chevron-down {
  right: 12px;
  left: auto;
}

.submenuItems {
  display: none;
  background: #cbe6c9;
}

.submenuItems li {
  border-bottom: 1px solid #86b686;
}

.submenuItems a {
  display: block;
  color: #727272;
  padding: 12px 12px 12px 45px;
  transition: all 0.4s ease-out;
}

.submenuItems a:hover {
  background: #cddc39;
  color: #fff;
}

4. Main JavaScript (jQuery) to enable the accordion menu.

//Create Function
$(function () {

  var Accordion = function (el, multiple) {
    this.el = el || {};
    //More Than One Menu Open
    this.multiple = multiple || false;

    var dropdownlink = this.el.find('.dropdownlink');
    dropdownlink.on('click', {
        el: this.el,
        multiple: this.multiple
      },
      this.dropdown
    );
  };

  Accordion.prototype.dropdown = function (e) {
    var $el = e.data.el,
      $this = $(this),
      //ul submenuItems
      $next = $this.next();

    $next.slideToggle();
    $this.parent().toggleClass('open');

    if (!e.data.multiple) {
      //Show Only one Menu at the same time
      $el.find('.submenuItems').not($next).slideUp().parent().removeClass('open');
    }

  };

  //Set Object
  var accordion = new Accordion($('.accordion-menu'), false);
});

Tiny Vertical Accordion Menu In jQuery Plugin/Github, accordion mega menu, vertical expand and collapse menu


See Demo And Download

Official Website(codeexpress333): Click Here

This superior jQuery/javascript plugin is developed by codeexpress333. For extra Advanced Usages, please go to the official website.

Related Posts

drag-drop-file-5x5-jq-uploader

Responsive Drag and Drop File Uploader/Download Plugin | 5x5_jq_uploader

5x5_jq_uploader plugin can be used to instantly create a drop file area and file queue with a little bit of preparation. Bootstrap is used for responsive planning…

Bootstrap-Dark-Mode

Stylesheet For Implementing Dark Mode with Bootstrap

Bootstrap Dark Mode provides a style sheet and two texts that allow you to implement Dark Mode on your website. Initially loaded based on user preferences, can…

responsive-navigation-menu

Multi-purpose Navigation Menu for Javascript Library | jQuery Corenav

coreNavigation is a multipurpose navigation menu for a jquery based javascript library, comes with more style, and is easy to integrate. 11 Default Menu 2 Responsive Navigation…

Simple-Multi-Select-Dropdown-Pure-Vanilla-Javascript

Simple Multi-Select Dropdown Pure Vanilla Javascript | multiSelect.js

MultiSelect.js is a simple, clean, and progressive JavaScript library designed for easy integration with any type of project or system. The design was heavily influenced by the…

Confetti-Falling-Animation-Effect-party

Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…

how-to-create-popup-in-html-with-css

How To Create A Popup in HTML with CSS

How to create popup in html with css – Popup without JavaScript is an elegant pop-up panel component with an animated scale, written in CSS. Have you…