jMenu: Horizontal navigations with unlimited dropdown sub-menus

jMenu is a jQuery plugin that enables us to create horizontal navigations with unlimited sub-menus.

Besides jQuery, it also requires jQuery UI and supports all the effects of this library (like fadeIn or slideDown).

The markup of the menu is pretty clean as it makes use of nested lists.

The look and feel of the output is set in a CSS file so updating it without touching the JS code is possible.

Download: https://github.com/jimmyfikes-dev/jMenu

Demonstration:

Plugin homepage:

Implementation:

1. First, include the css & jQuery files

<!-- include CSS & JS files -->
<!-- CSS file -->
<link rel="stylesheet" type="text/css" href="jmenu.css" media="screen" />
 
<!-- jQuery files -->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery-ui.js"></script>
<script type="text/javascript" src="jMenu.jquery.min.js"></script>

2. Now, add your HTML list

<!-- First, write your HTML -->
<ul id="jMenu">
  <li><a>Category 1</a>
    <ul>
      <li><a>Category 1.2</a>
        <ul>
          <li><a>Category 1.3</a></li>
          <li><a>Category 1.3</a></li>
          <li><a>Category 1.3</a></li>
        </ul>
      </li>
      <li><a>Category 1.2</a></li>
      <li><a>Category 1.2</a>
        <ul>
          <li><a>Category 1.3</a></li>
          <li><a>Category 1.3</a>
            <ul>
              <li><a>Category 1.4</a></li>
              <li><a>Category 1.4</a></li>
              <li><a>Category 1.4</a></li>
              <li><a>Category 1.4</a></li>
              <li><a>Category 1.4</a></li>
            </ul>
          </li>
        </ul>
      </li>
      <li><a>Category 1.2</a></li>
    </ul>
  </li>
</ul>

3. Finally, make a simple jMenu plugin call

<script type="text/javascript">
  $(document).ready(function(){
    // simple jMenu plugin called
    $("#jMenu").jMenu();
 
    // more complex jMenu plugin called
    $("#jMenu").jMenu({
      ulWidth : 'auto',
      effects : {
        effectSpeedOpen : 300,
        effectTypeClose : 'slide'
      },
      animatedText : false
    });
  });
</script>

Options:

openClickBooleanDefault : false – Choose if jMenu opens by clicking or hovering.
ulWidthIntegerDefault : auto – fix the the sub-menus widths.
absoluteTopIntegerDefault : 30 – The top pos (absolute) in pixel of the sub-menu compared to the parent.
absoluteLeftIntegerDefault : 0 – The left pos (absolute) in pixel of the sub-menu compared to the parent.
effectSpeedOpenIntegerDefault : 150 – In ms, slideDown/fadeIn speed of the sub-menus.
effectSpeedCloseIntegerDefault : 150 – In ms, slideUp/fadeOut speed of the sub-menus.
effectTypeOpenStringDefault : slide – Can be set to ‘slide’, ‘fade’ or ” (empty)
effectTypeCloseStringDefault : hide – Can be set to ‘slide’, ‘fade’ or ‘hide’ (empty)
effectOpenStringDefault : linear – All jQuery UI effects allowed
effectCloseStringDefault : linear – All jQuery UI effects allowed
TimeBeforeOpeningIntegerDefault : 100 – In ms, waiting time before sub-menus slideDown/fadeIn effects.
TimeBeforeClosingIntegerDefault : 100 – In ms, waiting time before sub-menus slideUp/fadeOut effects.
animatedTextBooleanDefault : false – If true, animations on the hover (see the next option paddingLeft).
paddingLeftIntegerDefault : 7 – In pixel, the padding-left animation on the hover.

Screenshots:

Multi Step Form Using HTML and JavaScript

Form is the important part in web design. Form is the primary interface to the user by which user is…

How to Create Custom CSS, jQuery Autocomplete Plugin

Web developers often use autocomplete features in websites as a part of their work. Yet lot of good …

How to Make Sticky Sidebar Using jQuery and CSS

Sticky sidebar is an essential part of web development. Not in all cases but for some cases where ou…

Selectors, Animation, and AJAX – jQuery Tutorial And Examples

By now I’m sure you have grasped at least the basics and simplicity of the jQuery library. Now it’s …

s3Slider jQuery Plugin & Tutorial

The s3Slider jQuery plugin is made by example of jd`s smooth slide show script. Usage: HTML: Sample …

jQuery Optimization: Avoid Unnecessary Selector

Common subexpression elimination is a common way to optimize any programming code. Doing unnecessary…