Tutorial: Multilevel Menu with CSS and JavaScript

by Mike Nichols · 41 comments

The code for the Multilevel Menu with CSS and JavaScript has been completely revised October 4-17, 2009. This tutorial has been changed to reflect the revisions, as well as being improved with new sections on how to build the menu and troubleshooting.

The Multilevel Menu with CSS and JavaScript is a fast, easy to implement dropdown menu with multiple levels. See it in action at my Thesis Demo site.

The menu files listed here produce a dropdown menu with multiple levels. Shown here is the menu as configured in this tutorial:

Figure 1: Dropdown menu with one level

Figure 1: Dropdown menu with one level

Figure 2: Dropdown menu with three levels

Figure 2: Dropdown menu with three levels

Included in the zip file provided for the menu is a configuration that mimics the standard Thesis navigation bar:

Figure 3: Dropdown menu configured to look like Thesis

Figure 3: Dropdown menu configured to look like Thesis

The Multilevel Menu offers these outstanding features:

  • Easy to set up and use.
  • Requires no plugin. Everything is done with CSS and JavaScript.
  • Any kind of URL, document or file can be put in the menu — no restrictions and no conditional php!
  • Dropdown menus with as many tabs and levels as you want.
  • Tabs may be in any order you want.
  • Dropdown menus have a sliding effect that is very appealing
  • Completely configurable as to size of tabs, font characteristics, colors, etc. with CSS.
  • Includes support for most major browsers, including most versions of Internet Explorer.
  • SEO friendly: Its unordered list is generated within the HTML of the page, so Google’s and other bots can read and index it.
  • Very fast execution. Uses Google libraries for speed.
  • Files include both a colored menu and one set up to look like the standard Thesis navigation menu.
  • In browsers with JavaScript disabled, the main tabs are still usable (but not the dropdowns)

The Multilevel Menu is based on an idea from the Dynamic Drive’s CSS Library that I modified for use with Thesis.

There is one drawback to the Multilevel Menu system: It requires working with the custom_functions.php file, even though the coding is minimal and very easy to do. If you would prefer using a plugin that has a gui interface for configuring a dropdown menu, there is a good tutorial, “Thesis Theme Tutorial – adding multilevel, nested, SEO friendly navigation menu to Wordpress” for using the WordPress navigation list plugin, NAVT.

Rather than copy the files shown below, I recommend you get everything — all files and the arrow graphics — in a single zip file. You can download it by clicking here.

Navigation in the Tutorial

This description of the Multilevel Menu with CSS and JavaScript is in five parts. If you want to skip to a particular part, just click on the links below:

How the menu works

There are three separate groups of code and two images that make this menu work:

  • A JavaScript file that does the actual work of building the menu
  • A CSS file that styles the menu
  • A set of functions to put into your custom_functions.php file
  • Two arrow images

These are listed and described below to help you understand how the menu works. All this code and the arrows are included in the zip file.

The JavaScript that builds the dropdowns

The following JavaScript does the actual work of building the multiple levels of the menu. I made some minor modifications to it, but it’s basically a script provided by Dynamic Drive. If you choose to create a file from the code below rather than use the zip file, you must name the file “jqueryslidemenu.js”.

/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Modified by Mike Nichols - July 10, 2009 - October 17, 2009
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

var jqueryslidemenu={

//Change the duration of the slide in/out animation - in milliseconds
animateduration: {over: 200, out: 100}, 

buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
				''
			)
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					var menuleft=this.istopheader? 0 : this._dimensions.w
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.slideUp(jqueryslidemenu.animateduration.out)
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}

//build menu with ID="slidemenu_jq" on page:
jqueryslidemenu.buildmenu("slidemenu_jq", arrowimages)

The CSS that styles the menu

Following is the CSS file that styles the menu. You have complete control over the fonts, the menu colors and borders, the tab size and spacing, and the dropdown items' size, among other things. The values in the CSS are those that I used to style the green menu on the Thesis Demo site, but you are completely free to change anything you wish.

I also made a version of this CSS code that mimics the standard Thesis navigation bar. The code for this version is not listed here, but it is in the zip file.

If you choose to create a file from the code below rather than use the zip file, you must name the file "jqueryslidemenu.css".

/* STYLING FOR THE MULTILEVEL DROPDOWN MENU WITH CSS AND JAVASCRIPT
Produces the green menu as seen on Thesis Demo
Modified and annotated by Mike Nichols - July 10, 2009
Revised October 4, 2009 */

/* COLOR CHART
#408000	- fern green	- menu strip
						- tabs
#53A502	- medium green	- tab dividers
#006500	- dark green	- submenu item dividers
#007200	- very dark green - tab and submenu item hover state
#80FF00	- lime green	- font hover state
*/

/* Class for Menu */
.slidemenu_class {
	/* font styling */
	font-weight: bold;
	text-transform: uppercase;
	font-size: 1.15em;
	font-family: Verdana, Arial, sans-serif;
	/* menu strip color */
	background: #408000;
	/* menu strip width */
	width: 100%;
}

/* Top level menu tabs */
.slidemenu_class ul li a{
	/* background color of tabs (default state) */
	background: #408000;
	/* font color (default state) */
	color: #FFFFFF;
	/* tab and menu strip height above letters */
	padding-top: .5em;
	/* tab and menu strip depth below letters */
	padding-bottom: .5em;
	/* tab width to right of letters */
	padding-right: .625em;
	/* tab width to left of letters */
	padding-left: .625em;
	/* border between tabs */
	border-right: 1px solid #53A502;
	/* no underline */
	text-decoration: none;
	/* do not change this! */
	display: block;
}

/* Top level link & visited font color */
.slidemenu_class ul li a:link,
.slidemenu_class ul li a:visited {
	color: #FFFFFF;
}

/* Top level tab background and font color during hover state */
.slidemenu_class ul li a:hover {
	background: #007200;
	/* font color */
	color: #80FF00;
}

/* Submenu level items */
.slidemenu_class ul li ul li a {
	/* font styling */
	font-weight: normal;
	font-size: 1.15em;
	font-family: Verdana, Arial, sans-serif;
	/* width of submenu items */
	width: 11em;
	/* height of submenu items above letters */
	padding-top: .313em;
	/* depth of submenu items below letters */
	padding-bottom: .313em;
	/* border between submenu items */
	border-bottom: 1px solid #006500;
	border-top-width: 0;
	margin: 0;
}

/* Submenu background and font hover colors */
.slidemenu_class ul li ul li a:hover{
	background: #007200;
	/* font color */
	color: #80FF00;
}

/* DO NOT CHANGE ANYTHING BELOW THIS LINE! */
/*=========================================*/

/* Top level list - Do not change! */
.slidemenu_class ul {
	margin: 0;
	padding: 0;
	list-style-type: none;
}

/* Top level list items - Do not change! */
.slidemenu_class ul li{
	position: relative;
	display: inline;
	float: left;
}

/* First submenu level - Do not change! */
.slidemenu_class ul li ul {
	position: absolute;
	left: 0;
	display: block;
	visibility: hidden;
}

/* All subsequent submenu levels vertical offset after first submenu level - Do not change! */
.slidemenu_class ul li ul li ul {
	top: 0;
}

/* Submenu level list items (undo style from Top level List Items) - Do not change! */
.slidemenu_class ul li ul li {
	display: list-item;
	float: none;
}

/* Down and right arrow images - Do not change! */
.downarrowclass {
	position: absolute;
	top: 12px;
	right: 7px;
}

.rightarrowclass {
	position: absolute;
	top: 6px;
	right: 5px;
}

/* IE6 hack to get sub menu links to behave correctly - Do not change! */
* html .slidemenu_class ul li a {
	display: inline-block;
}

The functions to put into custom_functions.php

Following are three functions that you place into your custom_functions.php file. The first function links the menu's CSS file into the head of your post/page HTML document. The second function links the required JQuery file and the JavaScript file into the foot of your post/page HTML document.

The third function actually describes your menu items. It consists of simple unordered HTML lists that become a part of the HTML when your page is rendered, so Google and other search bots will index them. If you choose to create a file from the code below rather than use the zip file, you must name the file "for-custom_functions.php".

/* -----------------------------------------------------------------*/
/* FUNCTIONS FOR THE MULTILEVEL MENU WITH CSS AND JAVASCRIPT */
/* Created by Mike Nichols - July 10, 2009 - Revised Oct 4-17, 2009 */
/* -----------------------------------------------------------------*/

/*--------------------------------*/
/* Link menu css in document head */
function slidemenu_head() {
?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo(template_directory)?>/custom/menu/jqueryslidemenu.css" />

<!--[if lte IE 7]>
<style type="text/css">
html .jqueryslidemenu{height: 1%;} /Hack for IE7 and below*/
</style>
<![endif]-->
<?php
}
add_action('wp_head','slidemenu_head');

/*-------------------------------------------------------*/
/* Call JavaScript and JQuery in footer, set arrow paths */
function slidemenu_foot() {
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script type="text/javascript">
var arrowimages={
down:['downarrowclass', '<?php bloginfo('template_url') ?>/custom/images/menu-arrow-down.gif', 23], right:['rightarrowclass', '<?php bloginfo('template_url') ?>/custom/images/menu-arrow-right.gif']
}
</script>

<script type="text/javascript" src="<?php bloginfo(template_directory)?>/custom/menu/jqueryslidemenu.js"></script>
<?php
}
add_action('thesis_hook_after_html','slidemenu_foot');

/*---------------------*/
/* Describe menu items */
function slidemenu(){
?>
<div id="slidemenu_jq" class="slidemenu_class">
<ul>

<!-- First level menu item shows on main menu tab -->
<!-- It is set up as your home tab -->
<li><a href="<?php bloginfo('url');?>">Home</a></li>

<!-- First level menu item with no dropdown -->
<li><a href="#">TAB 2</a></li>

<!-- First level menu item with one dropdown -->
<li><a href="#">TAB 3 WITH 1 DROPDOWN</a>
<!-- this is the dropdown -->
<ul>
<li><a href="#">DROPDOWN 1 ITEM 1</a></li>
<li><a href="#">DROPDOWN 1 ITEM 2</a></li>
<li><a href="#">DROPDOWN 1 ITEM 3</a></li>
<li><a href="#">DROPDOWN 1 ITEM 4</a></li>
</ul>
</li>

<!-- First level menu item with no dropdown -->
<li><a href="#">TAB 4</a></li>

<!-- First level menu item with three dropdowns -->
<li><a href="#">TAB 5 WITH 3 DROPDOWNS</a>
<ul>
<!-- this is the first level dropdown -->
<li><a href="#">DROPDOWN 1 ITEM 1</a></li>
<li><a href="#">DROPDOWN 1 ITEM 2</a>
<!-- this is the second level dropdown -->
<ul>
<li><a href="#">DROPDOWN 2 ITEM 1</a></li>
<li><a href="#">DROPDOWN 2 ITEM 2</a></li>
<li><a href="#">DROPDOWN 2 ITEM 3</a>
<!-- this is the third level dropdown -->
<ul>
<li><a href="#">DROPDOWN 3 ITEM 1</a></li>
<li><a href="#">DROPDOWN 3 ITEM 2</a></li>
<li><a href="#">DROPDOWN 3 ITEM 3</a></li>
<li><a href="#">DROPDOWN 3 ITEM 4</a></li>
<li><a href="#">DROPDOWN 3 ITEM 5</a></li>
</ul>
</li>
<li><a href="#">DROPDOWN 2 ITEM 4</a></li>
</ul>
</li>
</ul>
</li>

<!-- First level menu item with one dropdown -->
<li><a href="#">TAB 6 WITH 1 SUBLEVEL</a>
<!-- this is the dropdown -->
<ul>
<li><a href="#">SUBITEM 1</a></li>
<li><a href="#">SUBITEM 2</a></li>
</ul>
</li>
</ul>
<br style="clear: left" />
</div>
<?php
}
remove_action('thesis_hook_before_header', 'thesis_nav_menu');
/* YOU MUST UNCOMMENT ONE OF THESE ADD_ACTION LINES! */
/* PLACE THE MENU BEFORE THE HEADER */
/*add_action('thesis_hook_before_header', 'slidemenu');*/
/* PLACE THE MENU AFTER THE HEADER */
/*add_action('thesis_hook_after_header', 'slidemenu');*/

The images for the right and down arrows

There are two small image files for the right and down arrows in the menu. They look like this:

Figure 1: The right arrow image

Figure 4: The right arrow image


Figure 2: The down arrow image

Figure 5: The down arrow image

That's it! The following section tells you in detail how to set up the menu.

Setting up the Multilevel Menu with CSS and JavaScript

There are 3 steps for setting up your menu. Each step is not difficult, but the instructions must be followed to the letter. Most of the problems people experience when setting up the menu are because they skip a step or do not follow the directions.

Step 1: Set up a folder and copy files

Figure 6: Custom folder after creating the menu folder and copying files

Figure 6: Custom folder after creating the menu folder and copying files

1. Create a new folder named "menu" in your /custom folder.
2. Copy "jqueryslidemenu.js," "jqueryslidemenu.css" files into the new menu folder. If you downloaded the zip file, they are contained in a folder named "put-these-in-menu-folder." Also included in the zip file is "jqueryslidemenu-thesis.css" which mimics the Thesis standard navigation bar. If you want to try this out, it should go into the menu folder, too.

When you finish your custom folder should look like Figure 6.

Step 2: Upload the arrow images

Upload both arrow images to your /custom/images folder. They are named "menu-arrow-right.gif" and "menu-arrow-down.gif". If you downloaded the zip file, they are both in the folder named "put-these-in-custom-images-folder."

Step 3: Put the three functions into your custom_functions.php file

1. Copy and paste the three functions in the file "for-custom_functions.php" into your custom_functions.php file. It does not matter where these functions go. (Note that the "for-custom_functions.php" file is not uploaded to your server.)
2. At the bottom of the third function are two "add_action" statements. Important: Uncomment the one you want to use -- if you don't the menu will not appear and you will have no menu at all!

You're finished with the setup. Now you're ready to try it out!

How to Set Up Your Menu Items

The menu is just an HTML unordered list with the following structure. Adding menu items is simple, but you have to follow instructions carefully:

Main Menu Tabs
	First Level Dropdown Items
		Second Level Dropdown Items
			Third Level Dropdown Items
				...

1. Basically, you will be doing two things when setting up a menu item: putting in the item's URL, and putting in its menu description. Figure 7 shows a line before it has been set up.

Figure 4: Changing the menu items in the function

Figure 7: Changing the menu items in the function

2. The URL for your menu item replaces the pound sign (#). The description for the menu item -- the word(s) that actually show on the menu -- replace the example words. For example, if I am setting up Thesis Theme Tool's About page, it would look like the when I am finished. Remember that you can put any URL into any menu item:

<li><a href="http://thesisthemetools.com/about/">About</a></li>

3. Adding more menu items follows the same procedure. Just replace the pound sign with your URL and the example description with your description.
4. Note that the first tab is already set up as your home tab. You may change it if you wish.

Figure 5: Nesting of unordered lists in the function

Figure 8: Nesting of unordered lists in the function

5. When editing dropdowns, make sure that you observe the way the lists are constructed: The unordered list for dropdowns come right before the line item's "</li>" tag. This tag is placed after the end of the unordered list. In Figure 8 you will see the nesting of the tags represented by red lines.

Adding a Single Tab Item with No Dropdown

1. Copy a line with no dropdowns, such as the Home page line, "TAB 2" or "TAB 4" lines.
2. Paste the line in the code where you want the menu item to appear.
3. Replace the URL or pound sign with your URL, and the description with your description.

Adding a Single Tab Item with One Dropdown

1. Copy a group of lines with a single dropdown, such as the "TAB 3" or "TAB 6" lines. Be sure to copy all the lines associated with the tab.
2. Paste the lines in the code where you want the menu item to appear.
3. Replace the URLs or pound signs with your URL, and the descriptions with your descriptions.

Adding a Single Tab Item with Multiple Dropdowns

1. Copy a group of lines with a multiple dropdowns, such as the "TAB 5" group. Be sure to copy all the lines associated with the tab.
2. Paste the lines in the code where you want the menu item to appear.
3. Delete any submenus that you don't need. Be sure to delete all the lines associated with the unneeded submenus, but observe the menu's structure and don't delete too many!
4. Replace the URLs or pound signs with your URL, and the descriptions with your descriptions.

Deleting or Rearranging Menu Items

Menu items can be deleted or rearranged easily,
1. Cut the line or group of lines associated with the menu item. Make sure you get all the lines, but be sure you don't cut the lines of other groups! If you are unsure of which lines to cut, take a look at Figure 8 again.
2. If you are moving the menu item, find the place you want it and paste it there.

Usage tips for the Multilevel Menu with CSS and JavaScript

1. The menu lines have been commented and indented in the code to better show you the menu structure. I suggest you not erase these lines to make working with the menu easier.
2. Keep the file "for-custom_functions.php" so you can copy its menu lines when you need them.
3. Be careful about long menu descriptions for dropdowns. If they are too long, they may get cut off in the dropdown.
4. Remember that browsers with JavaScript turned off will only see the main menu tabs. You need to make these main menu tabs point to the more important areas of your site, and/or go to pages that have links to the dropdown's items.
5. If you want to see the version of the menu that mimics the Thesis standard navigation bar:

  • Make sure the "jqueryslidemenu-thesis.css" file is in your /custom/menu/ folder. If it isn't, copy it there.
  • Rename the "jqueryslidemenu.css" in your /custom/menu folder to something like ""jqueryslidemenu-green.css"
  • Rename the "jqueryslidemenu-thesis.css" file to "jqueryslidemenu.css"

This just changes the appearance of the menu. It doesn't change any of the contents of the menu, and all your menu items will still work.

Troubleshooting Your Menu

1. The menu does not appear

You did not uncomment one of the lines at the end of the "slidemenu" function. The look like this:

/* YOU MUST UNCOMMENT ONE OF THESE ADD_ACTION LINES! */
/* PLACE THE MENU BEFORE THE HEADER */
/*add_action('thesis_hook_before_header', 'slidemenu');*/
/* PLACE THE MENU AFTER THE HEADER */
/*add_action('thesis_hook_after_header', 'slidemenu');*/

2. The menu does not appear

Check the file path to the "jqueryslidemenu.js" in the "slidemenu_foot" function. It looks like this:

	<script type="text/javascript" src="<?php bloginfo(template_directory)?>/custom/menu/jqueryslidemenu.js"></script>

There are two main causes for this:

  • You named your menu folder something besides "menu." Just change the "menu" folder in the URL to the name of the folder you created.
  • Your server has a non-standard file setup. The "bloginfo" variable will find most standard Thesis setups, but you may have to put the full file path to the "jqueryslidemenu.js" file into the URL.

3. The menu appears as a vertical list on the left side of the screen

The solution to this problem is almost identical to item 2, above. The reason is because the program is not finding your "jqueryslidemenu.css" file. Check the file path to the "jqueryslidemenu.css" in the "slidemenu_head" function. It looks like this:

	<link rel="stylesheet" type="text/css" href="<?php bloginfo(template_directory)?>/custom/menu/jqueryslidemenu.css" />

Like item 2, there are two main causes for this:

  • You named your menu folder something besides "menu." Just change the "menu" folder in the URL to the name of the folder you created.
  • Your server has a non-standard file setup. The "bloginfo" variable will find most standard Thesis setups, but you may have to put the full file path to the "jqueryslidemenu.css" file into the URL.

4. Nothing happens when I click on a menu item, or all that appears in the browser address is a pound sign

You haven't set up the menu correctly, or you didn't delete unneeded menu items. Review the instructions in the "How to Set Up Your Menu Items" section above.

5. The menu moves too fast for my mouse to go to dropdown items, or the menu "stutters"

Usually this is caused by the JavaScript drawing and undrawing the menu too fast. Go to the "jqueryslidemenu.js" file in your menu folder. At the top of the file are some settings for how fast the menu draws. They look like this:

//Change the duration of the slide in/out animation - in milliseconds
animateduration: {over: 200, out: 100},

In particular, you might want to change the "out" parameter to a larger number. It will keep the menu from disappearing before your cursor has a chance to move over it.

6. The menu looks like "slats" in Internet Explorer

Usually this is due to padding and margin issues in the "jqueryslidemenu.css" file. IE interprets these differently from every other browser. Unfortunately, this doesn't happen with everybody's copy of IE -- just on some of them. You may want to experiment with the padding and margin values of the second level selectors to see if it solves your problem.

7. The menu does not let me pull the dropdown all the way down in Internet Explorer

This usually is due to the menu moving too fast for Internet Explorer. Try the solution in item 5, but make both the "in" and "out" variables a larger number.

Remember: rather than copy the files shown in the examples, I recommend you get everything -- all files and the arrow graphics -- in a single zip file. You can download it by clicking here.

I hope you try out the Multilevel Menu with CSS and JavaScript. It works very smoothly, and has been trouble-free for me on Thesis Demo. As always, your comments are welcome. You can also contact me by email by clicking the "Contact" button at the top of the page.

©2009 Michael L Nichols. All rights reserved.

What next?

Your comments are always welcome, and are important to this blog's community! Leave a comment now, or read the comments.

You can find several related articles in the "Related Articles" list below. In the footer you will find a lists of Popular Posts, Recent Posts, and you may browse by Categories, or tags. There's also a Google Custom Search box to help you find just what you want.

Get free updates by RSS or email!

If you have enjoyed this article, please consider subscribing to article updates, using an RSS reader, or by email. It's free and is a great way to make sure you don't miss a single article! I also invite you to follow me on Twitter!

Why not share this article with others!

Share this article with your friends using your favorite social media service, such as StumbleUpon, or Digg. Check out the icons below under "Share This Article With Others" for other social media, including del.icio.us, Technorati, Sphinn, Friendfeed, FaceBook, MySpace andLinkedIn! You can also email or print the article, and even tweet it using Twitter!

Share and Enjoy:
  • StumbleUpon
  • Digg
  • del.icio.us
  • Technorati
  • Facebook
  • MySpace
  • FriendFeed
  • Sphinn
  • LinkedIn
  • Twitter
  • email
  • Print
  • PDF
Related Articles

{ 2 trackbacks }

List of Wordpress Thesis Theme Tutorials, Tips and Hacks - EzyBlogger
July 17, 2009 at 11:13 am
Updated: Multilevel Menu with CSS and JavaScript | Thesis Theme Tools
October 11, 2009 at 2:29 pm

{ 39 comments… read them below or add one }

Nathan R. July 20, 2009 at 8:56 pm

Thanks for such an easy, fast solution for drop down menus. I tried it on my vacuum site: http://www.vacuumcleanersusa.com and it works great, but it seems to have interacted with the permalinks on the page?

Reply

Mike Nichols July 21, 2009 at 7:35 pm

Nathan, glad you were able to use the menu system! It truly is a fast solution if you have even the most basic coding skills.

I don’t think there’s any way for the menu to have changed your permalinks. All it does is query the pages — it doesn’t change anything. Perhaps it pointed up a permalink anomaly that you hadn’t noticed before?

Reply

Rob July 23, 2009 at 10:16 pm

Hi Mike…

Great tutorial however when I tried it on my test site and opened it in IE8 the drop down tabs flicker when I mouse over them…

http://www.taointernetconsultants.com/thesis

When I open your demo site in IE8 it seems to work fine. Any ideas?

Rob

Reply

Mike Nichols August 22, 2009 at 11:00 pm

Hello, Rob,

Thanks for the comment!

The menu is drawn by JavaScript and JQuery. It could be that you have another plugin that uses one or the other and is causing the flickering. I have also seen in when a margin property is used in jqueryslidemenu.css to move the menu up or down.

The demo site uses no other JavaScript and is located at the default hook, without moving it around.

Check these out and let me know if either is present in your system.

Reply

Melanie July 24, 2009 at 11:45 pm

I am using your design on my site, but I noticed that it goes haywire in Firefox. Your example site show up fine. Do you have a fix I can use?

http://www.escapingtheus.com

Thank you for this!!!

-Melanie

Reply

Mike Nichols August 22, 2009 at 11:03 pm

Hi, Melanie,

Sorry for the late reply to your comment.

The menu behaves as it should in Firefox for the Mac. Have you done anything to the code since you wrote your comment?

Reply

Melanie August 29, 2009 at 6:24 pm

Hi Mike!

You must be a busy man, ’cause you forgot that you fixed this for me a while back. Thanks again!

(By the way, I’m now looking for a vertical version for the sidebar.)

Again, thanks for the expertise and helpfulness!

Reply

Adam D July 25, 2009 at 6:50 pm

Mike,
Thank you so much for this great menu solution. After spending days headaching over IE problems, I now have something that works across browsers.

I do have one question. How can I get my “Subscribe” button to be totally right justified?

Let me know if you have any ideas.

Many thanks,

Adam D

Reply

Mike Nichols July 26, 2009 at 5:53 am

Adam, Thank you for the comment! It really pleases me that the menu is working for you. Did you use the Thesis-like menu version or customize the green one?

There are only a couple of drawbacks to this menu. One of them is that you can’t address menu tabs individually, like you can with the Thesis nav menu. That means that there’s no way to right justify the subscribe button.

There is a way around it. You could make a box class and font styling in custom.css and put a subscribe box up with a custom function. It doesn’t take long, and the user would not know the difference. You could even put a Thesis-like RSS icon in it if you wished.

I’ve got a tutorial in the works for doing something along those lines, and I ought to finish it in a few days — I’ve got some freelancing projects that are taking up my time at the moment so I can’t be any more specific. In fact, the RSS box would be a good subject for an example! So if you can wait a few days, I will have a tutorial based on your subscribe button problem.

Be sure to subscribe to my updates either by RSS or email. I always announce new articles, so you will know about it right away!

Reply

Melanie July 26, 2009 at 1:12 pm

Hi Mike, I thought I sent you a message, but I have four kids running around and there’s a good chance I never sent it.

First of all, thank you for this. It has worked beautifully at my site: http://www.escapingtheus.com

That is, it works beautifully on Internet Explorer. On Firefox, it looks like it’s on acid. (Or rather, that I am on acid looking at it.)

Your demo site works great on Firefox, so it’s obviously something about my own site that I am missing. Three years ago I didn’t know what HTML was or how to register a domain name, so that tells you what my expertise level is.

I appreciate any ideas you might have to fix this!

Best,
Melanie

Reply

Bill July 26, 2009 at 9:13 pm

Excellent tutorial on the Multi-Menu dropdown. I’m giving it a go on the site I am working on. Thanks.

Reply

Mike Nichols July 29, 2009 at 6:02 am

Rob, thank you for your comment!

Flickering of the menus is often caused by misplaced ’s in the function. It may not be enough to cause the menu to break, but it does cause rapid cycling of the menu. Check that you’ve got your nesting correct, as per Figure 8 and item 4 above.

Unfortunately, I do not have a Windows machine to check out the flickering issue first hand. But if you continue to have problems, let me know.

Reply

Mike Nichols July 29, 2009 at 6:05 am

Melanie, sorry for the delay in responding to your comments. They were caught in my spam filter, which I didn’t check for a couple of days due to a very busy schedule.

For the record, Melanie sent me an email, and we were able to clear up her problem quickly.
It was caused by misplaced ’s in her function in custom_functions.php.

Since this seems to happen more frequently than I’d like, I’m going to be adding a section to the tutorial to clarify the requirements for menu organization.

Reply

Mike Nichols July 29, 2009 at 6:08 am

Adam, thank you for your comment. It’s great that you’ve had such success with the menu!

I wrote you an email with the happy news that I’m almost finished with a tutorial on how to make elements and place them anywhere on the screen. It will include an example placing an RSS element onto the end of a Multilevel Dropdown menu! So just be patient and your solution will be ready-coded for you.

Reply

Mike Nichols July 29, 2009 at 6:09 am

Bill, thank you for the compliments! If I can be of any assistance, let me know.

Reply

jonas August 3, 2009 at 11:58 pm

Hi Mike — I’m really grateful that you took the time to do this — I was wondering how I might make a dropdown nav system and this really looks promising. Unfortunately, I think I must have missed a step or something — my dropdown menus is on the left-hand side of the site in between the header and the content, but it’s vertically oriented. What am I missing here? Is it that I simply have to delve into the CSS to style it appropriately or did I skip something?

Many thanks!
-Jonas
(and the site is http://spinozarods.com/)

Reply

Mike Nichols August 22, 2009 at 11:07 pm

Melanie, sorry you’re having a problem. Your previous comment came through. It might have gotten caught in my spam filter — I don’t remember after all this time.

Anyway, Firefox is more sensitive to errors in the HTML than other browsers. If you continue to have problems, use the “Contact” button and I will email you so you can send the problem file as an attachment so I can check it out.

Reply

Mike Nichols August 22, 2009 at 11:09 pm

Hello, Jonas,

Thanks for your comment. I sent you an email promptly, but I wanted to reply here for the record.

If your menu is vertical on the left side of the page, it is not finding the jsqueryslidemenu.css file. Recheck your URL for it in your header script.

Reply

Next Wave August 4, 2009 at 4:00 pm

Thanks. Is there a way to come up with a vertical Nav bar ?

Reply

Mike Nichols August 22, 2009 at 11:12 pm

Hi, Next Wave!

I have been working sporadically on a vertical nav bar. I’m more than half finished, and I need to just go ahead and complete it! Thanks for asking — it will spur me on to greater and higher things!

Reply

Next Wave August 5, 2009 at 9:31 am

???

Reply

Issa August 22, 2009 at 6:17 pm

Hello,

I’m very happy with your menu, however, I’d like to see if you could help me.

I’m trying to get the second menu to display horizontally. Rather than a vertical block, I’d like it to display as a second horizontal line, under the menu.

Is this possible with your current css?

Thanks!

Reply

Mike Nichols August 22, 2009 at 11:19 pm

Hello, Issa. I’m very glad you are using the menu and you are pleased with it.

I’m afraid that the way the menu is set up in the JavaScript, the second and subsequent levels of the menu display as a dropdown. There’s no way to change it easily: It would take rewriting the code to do it. The JavaScript is open source and I only made minor modifications to it. Unfortunately, my skills in the language are not sufficient to rewrite it.

If you want a secondary menu displaying horizontally, take a look at my Contextual Submenu. It’s in use at the top of this page under the Image Button Bar menu.

Reply

Issa August 23, 2009 at 3:57 pm

Thanks, Yeah I realized that yesterday.

I came across another question though. Is it possible to set the menu to highlight or alter the style on the currently selected menu item?

Thanks again for the awesome script and the followup help!

Issa

Reply

Mike Nichols August 24, 2009 at 12:15 am

Hi, Issa,

The menus have no mechanism for knowing which tab is selected like the Thesis menu does, so at present the selected tab is not highlighted. I am looking into it, though, and hope to find a solution.

Reply

Bill August 23, 2009 at 4:58 pm

Hey Mike:
Followed your tutorial to the letter and it worked perfectly. Thanks for all the work and sharing this menu system.

Reply

Mike Nichols August 24, 2009 at 12:17 am

Thank you for the compliments, Bill. I’m glad you’ve got it working for you. It’s important to follow the directions carefully as you did, otherwise the menu will exhibit some very strange behavior!

Reply

Issa August 24, 2009 at 2:21 am

Ah, thank you. Yeah, I was afraid of that. I was thinking probably the only way would be to add to the JS a complex dynamic class=”selected” but that’s beyond me, and there is probably a better solution.

I appreciate you looking into it, I’ll still be using your excellent menu in the meantime.

Take care,

Issa

Reply

Dianne August 26, 2009 at 9:21 am

Hello –

I LOVE your menu and it installed without a hitch however, I am experiencing the “flicker” issue with IE myself.

Can you tell me where to begin looking to try to fix the glitch?

Thanks so much!
Di

Reply

Russell August 26, 2009 at 3:53 pm

Hello Mike,

Congrats on a very complete tutorial, but I have managed to make it hard. I believe I have followed it very closely but nothing happened. I am playing with my site in a subdirectory and have been able to do everything up to the point of getting my Nav Bar to have submenus. Do you have any ideas, I am sure I missed something stupid.

Reply

jessica September 5, 2009 at 7:00 pm

hey,
Love your tutorial. very easy to follow. I am working on revamping an existing blog and the menu items came up, except instead of being horizontal below the header image, they are in a vertical column. I’m a decent coder, but i can’t figure out why this isn’t behaving properly. Maybe you can help?

the website is michelleverbeeck.com

Reply

jessica September 5, 2009 at 7:02 pm

also, i need to know, how did you put the twitter id in the comments to get the follow me on twitter under my name. I’ve never seen that before.

thanks for all your help.

Reply

jessica September 5, 2009 at 7:08 pm

fixed the menu problem, now i just want to know about your twitter id in comments. sorry for all the comments i’ve left today. and thanks for the tutorial. it was great.

Reply

Harsh @Shoutmeloud September 6, 2009 at 6:28 pm

Hey Mike
Great work and you surely deserve a Kudos. I’m trying this and with the things and guide u have provided I’m sure it will not take much time to use it.
Regards
Harsh

Reply

Tom September 9, 2009 at 6:47 am

Hi Mike
Forgive me if I’m missing a trick here… I’ve implemented, and it worked like a dream – thank you. However, I’m now left to construct my menu items manually in the code – there’s no connection with the Thesis theme’s management of navigation items in Thesis Options.
I need the site to be able to manage navigation items in there… is this an option with your plugin?
Thanks, Tom

Reply

toptrojan September 9, 2009 at 9:39 am

I use this drop down menu code and love it. See it at http://newhopetrojans.com

@Russell – pay careful attention to the instructions about uncommenting the “add action” statement by removing the appropriate /* and */ from the code.

@Tom – Correct, constructing your menu items manually in the code provides the maximum flexibility for placing any item at all in your dropdown menu. For instance, I have an address and phone number (unlinked) dropping down under HOME. The menu item can link to any URL as well. You can mix and match outside URL’s with URL’s internal to your site. As I understand it, Thesis 1.6 is close to release and will have built in dropdown menu functions. Will the Thesis Options be as flexible – we’ll soon see.

Hope this helps and thanks to Mike for this tutorial.

Reply

Carrie September 10, 2009 at 3:31 pm

Hi Mike,

My client loves your theme but wants to know (and I can’t find it in your tutorials) if is it possible to have multi-color multi-level tabs? If yes, could you point me in the right direction?

Thanks!

Reply

Chris Krauskopf February 26, 2010 at 3:57 pm

Hi Mike,

I’m having a few issues with the menu, I was hoping you could tell me what’s wrong. Basically, the top header tabs work as links, and the drop downs animate and display the correct items, but hovering over any of the drop down menu items does nothing. It doesn’t change the color the way the css says it should, and clicking on any of the items doesn’t execute the link. I tried slowing down the javascript animation as per your troubleshooting instructions, but that did not seem to be the issue – I can get my mouse to hover over a menu item, but it doesn’t do any good (the menu keeps retracting) and clicking the submenu links still doesn’t work)

Any thoughts, short of reinstalling the whole menu?

Thanks

Reply

Chris Krauskopf February 26, 2010 at 4:11 pm

I replace my modified jqueryslidemenu.css and jqueryslidemenu.js files with your original files, and still have the same problem – so that tells me that the issue must be in the customfunctions.php file – right? But I can’t see what is different than your example.

Reply

Leave a Comment

  • Visit My Other Site!