Create The Fanciest Dropdown Menu You Ever Saw

Home Ā» Web Development Ā» Create The Fanciest Dropdown Menu You Ever Saw

Good evening web designers. I hope you have all had a great weekend, and are ready to start the working week tomorrow. I have something very special to share with you today. Back in June when I wrote the post 21 Beautiful And Creative Navigation Menus, we had a comment from Brian Cray, in which he shared his menu with us. After speaking with Brian, he agreed to write a tutorial for us on how he createdĀ  his website navigation menu.

Recently he has changed his website design and the layout, but this tutorial is sweet, and one amazing navigation! Here is a bit about Brianā€¦

About Brianā€¦
Brian Cray writes a blog that helps web 2.0 professionals build better websites. Among other things, he is known for his development of Nearby Tweets and PXtoEM.com. Feel free to follow him on Twitter.

Be sure to check out some of the services that Brian provides, and if you have any questions for Brian feel free to drop in a comment and I am sure he will reply.

What will you be building?

See the working demo

final

Contentsā€¦
  1. Making a basic dropdown menu that works
    1. The basic HTML
    2. The basic CSS
    3. The basic jQuery
  2. Making the basic menu look fancy
    1. The images
    2. The fancy HTML: What weā€™ve changed
    3. The fancy CSS: What weā€™ve added
    4. The fancy jQuery: What weā€™ve changed
  3. The final result with files

* * * * *

1. Making a basic dropdown that works

Before I begin ā€“ for those of you who want an easy way out of this tutorial, you can create a freeĀ  flash website with Wix that will look like a very professional website. Now for those who are still interested in going through with the tutorial, I will continue. Web designers and developers find themselves creating dropdown menus over and over. Iā€™ve drilled dropdown menu production to a science. Seriously. Hereā€™s the benefits of Brian Crayā€™s basic dropdown menu code:

  • Can be put anywhere on site in a matter of seconds
  • Forces no styling on the menu, but adapts to ANY styling
  • Can handle multiple dropdown levels gracefully
  • Covers variable-width tabs and dropdown menus
  • Semantic ā€“ only two classes needed on an otherwise plain UL

Hereā€™s what the basic dropdown looks like

Letā€™s go over my dropdown menu code first as it provides the basis for the fanciest dropdown menu you ever saw.

The basic HTML

Youā€™ve seen this kind of thing a million times. But take notice of the two UL classes: tabs and dropdown.

[html]<ul class=ā€tabsā€>
<li><a href=ā€#ā€>Dropdown 1</a>
<ul class=ā€dropdownā€>
<li><a href=ā€#ā€>Menu item 1</a>
<ul class=ā€dropdownā€>
<li><a href=ā€#ā€>Submenu item 1</a></li>
<li><a href=ā€#ā€>Submenu item 1</a></li>
<li><a href=ā€#ā€>Submenu item 1</a></li>
</ul>
</li>
<li><a href=ā€#ā€>Menu item 2</a></li>
<li><a href=ā€#ā€>Menu item 3</a></li>
<li><a href=ā€#ā€>Menu item 4</a></li>
<li><a href=ā€#ā€>Menu item 5</a></li>
<li><a href=ā€#ā€>Menu item 6</a></li>
</ul>
</li>
<li><a href=ā€#ā€>Dropdown 2</a>
<ul class=ā€dropdownā€>
<li><a href=ā€#ā€>Menu item 1</a></li>
<li><a href=ā€#ā€>Menu item 2</a></li>
<li><a href=ā€#ā€>Menu item 3</a></li>
<li><a href=ā€#ā€>Menu item 4</a></li>
<li><a href=ā€#ā€>Menu item 5</a></li>
<li><a href=ā€#ā€>Menu item 6</a></li>
</ul>
</li>
<li><a href=ā€#ā€>Dropdown 3</a>
<ul class=ā€dropdownā€>
<li><a href=ā€#ā€>Menu item 1</a></li>
<li><a href=ā€#ā€>Menu item 2</a></li>
<li><a href=ā€#ā€>Menu item 3</a></li>
<li><a href=ā€#ā€>Menu item 4</a></li>
<li><a href=ā€#ā€>Menu item 5</a></li>
<li><a href=ā€#ā€>Menu item 6</a></li>
</ul>
</li>
</ul>[/html]

The tabs class makes the first UL a horizontal tab bar. The dropdown class makes the other UL dropdown menus. Simple, right?

The basic CSS

This CSS sets and resets the necessary styles so you donā€™t have to worry about your menu inheriting a bunch of crap that will make the menu look unexpected.

[css]/* tabs
*************************/

ul.tabs
{
display: table;
margin: 0;
padding: 0;
list-style: none;
position: relative;
}

ul.tabs li
{
margin: 0;
padding: 0;
list-style: none;
display: table-cell;
float: left;
position: relative;
}

ul.tabs a
{
position: relative;
display: block;
}

/* dropdowns
*************************/

ul.dropdown
{
margin: 0;
padding: 0;
display: block;
position: absolute;
z-index: 999;
top: 100%;
width: 250px;
display: none;
left: 0;
}

ul.dropdown ul.dropdown
{
top: 0;
left: 95%;
}

ul.dropdown li
{
margin: 0;
padding: 0;
float: none;
position: relative;
list-style: none;
display: block;
}

ul.dropdown li a
{
display: block;
}[/css]

The basic jQuery

The jQuery behind this is genius. It will pick up ANY dropdown class on the page and turn it into a working dropdown menu.

[js]$(function () {
$(ā€˜.dropdownā€™).each(function () {
$(this).parent().eq(0).hover(function () {
$(ā€˜.dropdown:eq(0)ā€™, this).show();
}, function () {
$(ā€˜.dropdown:eq(0)ā€™, this).hide();
});
});
});[/js]

And thatā€™s all you need to add to each project to create dropdown menus in a flash! Now lets take this concept a step farther and REALLY light up the show.

2. Making the basic menu look fancy

Hereā€™s what the fancy menu looks like that weā€™ll create below

The first thing to do to make something fancy is to add colors and images.

The images

download

The fancy HTML: what weā€™ve changed

  • Wrapped everything in a #menu div
  • Added h4 elements to add another layer to the menuā€™s organization
  • Added a ā€œhasmoreā€ class to the menu items containing dropdown menus
  • Added a ā€œlastā€ class to the last menu item in dropdown menus
  • Added a <span> element around the main menu items

[html]<div id=ā€menuā€>
<ul class=ā€tabsā€>
<li><h4><a href=ā€#ā€>In the blog Ā»</a></h4></li>
<li class=ā€hasmoreā€><a href=ā€#ā€><span>Recent</span></a>
<ul class=ā€dropdownā€>
<li><a href=ā€#ā€>Menu item 1</a></li>
<li><a href=ā€#ā€>Menu item 2</a></li>
<li><a href=ā€#ā€>Menu item 3</a></li>
<li><a href=ā€#ā€>Menu item 4</a></li>
<li><a href=ā€#ā€>Menu item 5</a></li>
<li class=ā€lastā€><a href=ā€#ā€>Menu item 6</a></li>
</ul>
</li>
<li class=ā€hasmoreā€><a href=ā€#ā€><span>Topics</span></a>
<ul class=ā€dropdownā€>
<li><a href=ā€#ā€>Topic 1</a></li>
<li><a href=ā€#ā€>Topic 2</a></li>
<li><a href=ā€#ā€>Topic 3</a></li>
<li class=ā€lastā€><a href=ā€#ā€>Topic 4</a></li>
</ul>
</li>
<li><a href=ā€#ā€><span><strong><img src=ā€images/feed-icon-14Ɨ14.pngā€ width=ā€14ā€³ height=ā€14ā€³ alt=ā€RSSā€> Subscribe to RSS</strong></span></a></li>
<li><h4><a href=ā€#ā€>Elsewhere Ā»</a></h4></li>
<li><a href=ā€#ā€><span>About</span></a></li>
<li class=ā€hasmoreā€><a href=ā€/about/#networksā€><span>Networks</span></a>
<ul class=ā€dropdownā€>
<li><a href=ā€#ā€>Twitter</a></li>
<li><a href=ā€#ā€>posterous</a></li>
<li><a href=ā€#ā€>SpeakerSite</a></li>
<li><a href=ā€#ā€>LinkedIn</a></li>
<li class=ā€lastā€><a href=ā€#ā€>See moreā€¦</a></li>
</ul>
</li>
<li><a href=ā€#ā€><span>Bookmarks</span></a></li>
</ul>
</div>[/html]

The fancy CSS: what weā€™ve added

  • Added the * {margin:0; padding:0} simple reset hack (I know, there are better resets)
  • Styled to body
  • Removed underline from links
  • Styled the menu heavily

[css]/* hack reset (for production, use Yahoo! reset CSS)
*************************/

*
{
margin: 0;
padding: 0;
}

/* body
*************************/

body
{
font: 14px/21px Georgia, serif;
color: #370707;
background: #e3d79b url(images/mainbg.jpg) left 40px repeat-x;
}

/* links
*************************/

a:link, a:visited, a:hover, a:active
{
text-decoration: none;
}

/* inline elements
*************************/

strong
{
font-weight: bold;
}

/* menu-specifc
*************************/

#menu
{
position: fixed;
z-index: 5;
top: 0;
left: 0;
width: 100%;
height: 40px;
line-height: 40px;
background: #ffb35a url(images/topbg.gif) repeat-x;
border-bottom: 1px solid #000;
}

#menu ul
{
margin: 0 auto;
}

#menu ul li.hasmore
{
background: url(images/drophighlight.png) no-repeat center 27px;
}

#menu ul li h4
{
margin: 0;
}

#menu ul li h4 a
{
font-size: 14px;
color: #000;
font-weight: bold;
padding: 0 15px;
}

#menu ul li a
{
color: #9b2021;
padding-left: 4px;
}

#menu ul li a img
{
vertical-align: middle;
}

#menu ul li a:hover
{
background: url(images/topselectionleft.png) top left no-repeat;
}

#menu ul li a span
{
display: block;
padding: 0 15px 0 11px;
}

#menu ul li a:hover span
{
background: url(images/topselectionright.png) top right;
}

#menu ul.dropdown
{
padding: 10px;
background-image: url(images/dropdown.png);
overflow:hidden;
border-bottom: 1px solid #dc902f;
width: 290px;
}

#menu ul.dropdown li a
{
border-bottom: 1px solid #e5cd8e;
line-height: 30px;
overflow: hidden;
height: 30px;
}

#menu ul.dropdown li.last a
{
border-bottom-width: 0;
}

#menu ul.dropdown li a:hover
{
background: url(images/menuarrow.png) no-repeat left center;
}

#menu ul li h4 a:hover
{
background-image: none;
}[/css]

The fancy jQuery: what weā€™ve changed

  • Used the hoverIntent jQuery plugin by Brian Cherne instead of jQueryā€™s default hover to prevent unintended dropdown menus
  • Used the easing jQuery plugin by GSGD to add a visual effect to dropdown menu items
  • Changed the default dropdown menu show() and hide() functions to slideDown() and fadeOut() to add some pizzazz (without being annoying)
  • Preloaded the images necessary to make the menu happen

[js]$(function () {

$(ā€˜.dropdownā€™).each(function () {
$(this).parent().eq(0).hoverIntent({
timeout: 100,
over: function () {
var current = $(ā€˜.dropdown:eq(0)ā€™, this);
current.slideDown(100);
},
out: function () {
var current = $(ā€˜.dropdown:eq(0)ā€™, this);
current.fadeOut(200);
}
});
});

$(ā€˜.dropdown aā€™).hover(function () {
$(this).stop(true).animate({paddingLeft: ā€™35pxā€™}, {speed: 100, easing: ā€˜easeOutBackā€™});
}, function () {
$(this).stop(true).animate({paddingLeft: ā€˜0ā€™}, {speed: 100, easing: ā€˜easeOutBounceā€™});
});

pic1 = new Image(310, 672);
pic1.src = ā€œimages/dropdown.pngā€;

pic2 = new Image(4, 40);
pic2.src = ā€œimages/dropselectionleft.pngā€;

pic3 = new Image(394, 40);
pic3.src = ā€œimages/dropselectionright.pngā€;

});[/js]

3. The final result with files

Congratulations! Youā€™ve walked through creating the fanciest menu ever! By the way, if you feel frustrated with designing, or just want an easy way out, you can always create a free professional Website with Wix.

Here are the files this menu uses:

Author
Iggy
Iggy is an entrepreneur, blogger, and designer who loves experimenting with new web design techniques, collating creative website designs, and writing about the latest design fonts, themes, plugins, inspiration, and more. You can follow him on Twitter

155 thoughts on ā€œCreate The Fanciest Dropdown Menu You Ever Sawā€

  1. Whatā€™s Happening i am new to this, I stumbled upon this Iā€™ve found It positively helpful and it has aided me out loads. I hope to contribute & assist other users like its aided me. Great job.

    Reply
  2. Hello! Iā€™ve been reading your website for some time now and finally got the courage to go ahead and give you a shout out from Lubbock Texas! Just wanted to say keep up the good job!

    Reply
  3. I was wondering the jQuery cod, i have never used it before and i donā€™t know, where to add it? In the HTML? Css? or a new?

    Reply
  4. Good tutorial! Sarah asked:

    ā€œI noticed on mobile (specifically iPhone) that the menus will not close once they are open. Even if you click outside the menu or click back on the top-level item ā€” they stay open!ā€

    I have the same problem, any solution?

    Thank you,

    Reply
  5. this works great, and Iā€™ve been able to tweak it with CSS, but when I try to separate the jQuery1.3.4 from the other code, it doesnā€™t seem to work. Can you get it to play nice with jQuery 1.9?

    Reply
  6. Hi there!

    I am having a hard time because I am using the slidesJS on the same page as this dropdown menu and so far, it will only give me one or the other, depending on how I have my external links listed. Is there anything that I can do about it? Here is a link to a discussion I started that has all my coding and everything! Thanks so much in advance to your help!

    ā€”> https://groups.google.com/forum/?fromgroups=#!topic/slidesjs/B6PTFRWYDyw

    ps. I love this dropdown menu. ::)

    Reply
  7. Great tut! It has helped me out of a hole.

    I do have a couple of questions though.

    I have found a way to align the drop down text to the left of the drop down box by adding {text-align: left} to the CSS but on hover over the text jumps to the middle. Any ideas how to stop this from happening?

    Also I need the menu to align to the right of my site. This means on some screens the drop down goes off the screen. Is there a way to move the drop down to the left of the main link rather than the right?

    Cheers

    Reply
  8. hi webdesgindev
    do you know that i really love you?
    i guess i read your site times a day. you r amazing. I send lots of positive energy for you each time i read your articles.
    tnxxxxxxxx

    Reply
  9. Hi, me again!

    I noticed on mobile (specifically iPhone) that the menus will not close once they are open. Even if you click outside the menu or click back on the top-level item ā€” they stay open!

    Does anyone know of a workaround on this?

    Sarah

    Reply
  10. How could I use the symbol of that showing hand if I have only html/css on the website and a horizontal submenu, where and how should I put that photo ? Thank you.

    Reply
  11. Hi,
    thank you for this. I am a serverside programmer.
    stuck with menu in jquery. Your tutorial solved my problem.
    regards
    vinodh

    Reply
  12. Same problem. This does not work with my jquery content slider. Drop down functionality quits. Solutions?? Desperate hereā€¦

    Reply
  13. Lovely! But I ran into something bizarre.
    IE (naturally) on 7 and 8, the drop downs donā€™t want to function when there is a .swf embedded on the page (using tag generated by Flash publish settings).

    Reply
  14. DoesnĀ“t work.
    Subitem 1:3 apperas outside Imtem 3:1 to the right on FIREFOX when ā€œmoving the mouse slowlyā€ on the drop down 1:2

    Reply
  15. Hello I am making a site for a non profit organisation, just wanted to know if I can use the code u have given as is or even after me modifying it to fit in my needs.

    Awaiting your response.

    Reply
  16. Why does this script popup an active X warning? Is there anyway to get rid of that. Is that because of the settings on my browser? Will many people also have that problem? Thanks.

    Reply
  17. The menu looks great, I will have to try it out even if some of the comments indicate that there might be potential problems with it.

    Reply
  18. Works nicely for me on ie7 except that nested drop downs are a bit of a pain. When one moves oneā€™s mouse from drop down level to nested drop down level the nested drop down level disappears too easily so that selecting an element in the nested drop down level is very difficult. Any workarounds for this?

    Reply
  19. Very Nice. But when I take the div id=menu and put that in a table cell. The image that display when the mouse hover over the links, does not align to the top of the table cell. Any figure out why is that?

    Reply
  20. Thank for the great tutorial.

    But it doesnā€™t seem to be working in IE 7.
    Can anybody please help me fix the issue or help me move in the right direction to get it fixed?

    I have installed debugbar and that doesnā€™t seems to even recognize the javasciprt file.

    Reply
  21. Hi, Its a great menu. I was wondering how it might be possible to make the menu title hover image remain when the drop down is displayed. Currently it only displays when you hover over the title. When you move the cursor onto the drop down, the title is no longer hi-lighted.

    Also, Iā€™m concerned about the compatibility with safari, chrome etc. Does anyone here know how to fix those problems?

    Reply
  22. I am trying to add this menu into an existing table on an existing page. The menu just gets jammed to the top and wrecks the rest of the page contents. What am I doing wrong?

    Reply
  23. I need some help!
    I used this dropdown menu but I added a video underneath the menu and then the dropdowns disappear under the video.
    How can I solve this? I tried z-index, but it doesnā€™t help.

    Thanx

    Reply
  24. This is a beautiful menu effect, but unfortunately it doesnā€™t work with the most recent version of jQuery (1.5 as I write this). Iā€™ll take a look at it and see if I can get it working. Hopefully it can be resolved because itā€™s a really wonderful effect.

    Reply
  25. Thank you for your efforts. Really GREAT tutorial.

    I have only one question. Is there any way to make drop down scroll up?

    Reply
  26. great menu, but dropdown wont work in google chrome, opera or safari it works fine in IE and firefox . anyone knows what makes problems with that 3 browsers?

    Reply
  27. This works perfectly for me when I upload it within a basic HTML page. Butā€¦ when I place it in a header.php and call it from another .php file there are a few issues. For example, the top menu links are not centered, and a few image issues as well.
    Probably something simple I forgot like moving the decimal point, but any help would be appreciated!

    Reply
  28. although both jquery js, as many people mentioned in the comments above, lightbox doesnt work which makes the menu pretty but useless nevertheless. It is very often lightbox is used this days. So I dont know if the writer can suggest sth.

    Reply
  29. When I comment out the hard coded jquery source and use the latest versionā€¦there is no drop down.

    All I have done is is commented out that single line of hardcoded jquery and made sure the jquery plugin was included in my master page.

    Any ideas as to why the dropdown may not be working?

    Reply
  30. The menu is awesome, it looks great on my site.
    The thingā€™s Iā€™ve it installed with WordPress, and I have a plugin (Google Calendar Events) which is having conflicts with this.

    The weird thingā€™s that when I tested it with jQuery 1.5 in a file on my server, it works fine. When I activate the plugin and remove the code calling jQuery 1.5 from my site (because the plugin calls jquery 1.4.4) it doesnā€™t work.

    Iā€™ve tried a lot of things, and actually I have the dropdown in a different file than jQuery which I call from a .js file on my header.

    How should I fix it?

    Thanks,

    Reply
  31. The menu looks fantastic, but Iā€™m having some trouble positioning it using Dreamweaver cs3. Regardless of how I style it, it wants to remain at the top of the page. Iā€™m pretty new with Dreamweaver. Any suggestions would be appreciated. Thanks in advance!

    Reply
  32. Hi, excellent tutorial.
    This works perfectly for me when I upload it within a basic HTML page. Butā€¦ when I place it in a header.php and call it from another .php file there are a few issues. For example, the top menu links are not centered, and a few image issues as well.
    Probably something simple I forgot like moving the decimal point, but any help would be appreciated!

    Reply
  33. hello there..the menu is great, but it doesnā€™t work at all in my first page, where I have installed the front page slideshow provided by joomla.Is there anything I can do, so that it works?

    also it didnā€™t work in the pages I loaded lightbox.js (this is not so serious, I used highslide which doesnā€™t affect the fancydropdown menu)

    thanx!

    Reply
  34. FIX ERRORS WITH ADDITIONAL PLUGINS:

    In fancydropdown.js ā€“
    ā€“ Delete: jquery 1.3.2 code (top of page until comments about Sizzle Selector Engine)
    ā€“ Remove: Sizzle CSS Selector code (comment shows beginning of code, BUT do not delete jquery easing. This was not commented to show the beginning of this code, there was just a line break. The code starts likeā€¦jQuery.easing[ā€˜jswingā€™]=jQuery.easing[ā€˜swingā€™]ā€¦. do not delete this or anything below it)

    Then you should be right to go!

    Reply
    • Thanks for that, worked great! Any idea how to get it working in IE7? Iā€™m having the same problem as a few others, the menu is showing behind other elements even after setting the z-index higher.

      Reply
  35. Im a bit confused here. I have tested the html code in Microsoft Expression web, and it looks fine, but when I transfer it all to the hosting site, I get only the code displayed. I have also moved the css and js files, and am unsure what Im missing.

    Reply
  36. Implemented this on a site and in IE7 the menu drops down behind the items below it, Iā€™ve updated the z-indexing and I still canā€™t get it to dropdown over the content below it, which is kind of a big flaw for me.

    Reply
  37. Thanks for a great tutorial! Itā€™s exactly the effect I was looking for.

    May I offer a suggestion? Save the script as its own fancymenu.js file instead of packaging it with jquery and the other plugins. Iā€™m using a newer version of jquery and didnā€™t want to include it twice.

    Might the grouped packaging be causing the plugin conflicts, where some users found the menu doesnā€™t work with other jquery plugins?

    I was able to copy the JS from this tutorial into a separate file ,but the code needed tweaking since it contains nonstandard single- and double- quotes. (for example, left quote ā€˜ and right quote ā€™ have to be changed to straight quote ā€˜ )

    But after that simple tweak it looks and works great. Thanks!

    Reply
  38. hi there,
    the menu is real nice but i have a problem when i want more levels.
    First level is ok but for the second level i can only see part of the menu. i have the first letter of the text. I t hink itā€™s a problem with the css but i donā€™t know how to modify it.
    can anyone help plzzzzzzzz!!!!!

    Reply
  39. Very nice, it worked well with Firefox.

    But it didnā€™t work with IE (my version is IE 7). It was doing the ā€œdropping downā€ animation when the mouse hovers on the menu, but when the mouse pointer attempts to move over the ā€œdropped downā€ submenus, the ā€˜dropped downā€™ submenus quickly disappear, rendering them useless.

    Anyone knows where the problem might be at? The code? or the jQuery, or the JavaScript?

    Reply
  40. great menu, but dropdown wont work in google chrome, opera or safari

    it works fine in IE and firefox

    anyone knows what makes problems with that 3 browsers?

    Reply
  41. this menu is SEXY as hell ā€“ BUT when i add it to my site it doesnt play nice with jquery cycle pluginā€¦any suggestions?

    it breaks the cycle scriptā€¦if i take out the

    then the slideshow plays as normalā€¦

    Reply
    • I couldnā€™t agree more. Awesome tutorial! Iā€™ve been struggling trying to get a decent CSS menu for a long time but your article nailed it.

      Time to implement!
      Thanks again.

      Reply
  42. Why this script block any jquery gallery?
    Whats the solution?
    I cant find the problem line

    When I delete the .js script all image gallerys works fine.

    Reply
    • the fancydropdown.js file contains the code of the jquery-1.3.2.min.js file. just split the code and import the two files individually

      Reply
      • Same issue here. Impossible to use fancydropdown with any other type of lightbox.

        I did identify the jquery 1.3.2 from fancydropdown.js, and isolated it in a separate js to call him indivually, or to call an other recent jquery instead but the dropdown stop working.

        Any other clues guys?

        Cheers.

        Reply
  43. This menu looks awesome!

    I made a change in the css so that when a user is in the drop down menu the ā€œOver Stateā€ of main navigation does not disappear.

    I replaced the css:

    #menu ul li a:hover
    {
    background: url(images/topselectionleft.png) top left no-repeat;
    }

    With:

    #menu ul li:hover {
    background-image:url(../images/backgrounds/nav-hit.gif);
    background-repeat:repeat-x;
    color:#193b65;
    }

    #menu ul li:hover a {
    color:#193b65;
    }

    Of course you can change your background image as needed.

    Keep up the good work.

    Reply
  44. Thanks for the tutorial, Iā€™d like to implement it, but Iā€™m having a problem.

    Iā€™d like to separate out the jquery library and have it in its own file to fancydropdown.js. But whenever i try this, the dropdown stops working. This is when Iā€™m even using the same jquery version 1.3.2 as is included in the original js.

    Anyone know how to solve this?

    Reply
  45. Hey just built a site using this, was testing it works great in Safari, but in Firefox does not work unless Javascript is enabled, which most common people wont even change default settings in their browsersā€¦ So what can i do to make sure they get some type of menu if they have Javascript disabled?

    Reply
  46. Forget that question..it was an easy fix, just had to take out the overflow: hidden rule in the #menu ul.dropdown

    Thanks, this looks great! Very much appreciate it!

    Reply
  47. Does anyone know how I can add a second dropdown sub-menu to this?

    For instance if you look at the screenshot of the menu at the top of the page, I would like to have another dropdown sub-menu to pop out when I scroll over Topic 1, Topic 2 etc.

    Here is the code I tried to add the sub-menuā€¦

    Topic 1 Ā»

    Topic 1.1

    Topic 1.1.1
    Topic 1.1.2
    Topic 1.1.3
    Topic 1.1.4

    Topic 2
    Topic 3

    The sub-menu (topic 1.1.1, 1.1.2, 1.1.3, 1.1.4) would pop up when I hover over topic 1.1 as it should BUT it is contained inside the original dropdown. In other words when I would hover over topic 1.1 the dropdown would show on like the last 40 pixels or so of the right side of the original dropdown. It would not dropdown to its own container.

    Does anyone have any ideas on how to help with this? If anyone needs more info or cant understand what im saying, let me know and ill try to describe it better.

    Thanks a lot, I really appreciate it!

    Reply
  48. Great work, really like it! I notice that in IE7 (at least) the active tab background image is ā€œcut offā€ directly above the textā€¦ any CSS gurus out there have a fix for this? Excellent menu though, well done!

    Reply
  49. Wow and wow I loved the new fanciest drop down menu a lot and now I am going to use this technique in my site and then post it in a contest running by grafikguru.com and I am sure I would win the prize.

    Reply
  50. Iā€™ve think Iā€™ve tried everything under the sun to reduce line spacing for drop-down menu items. Unless Iā€™m mistaken, no CSS selector seems to have the power to affect the spacing, and this is disappointing for designers who might not want to dedicate the entire space occupied by long drop-down items.

    To compensate, I tried adding transparency to a background in the #menu ul.dropdown selector so that when drop-downs overlap page content, the content remains partially visible. Unfortunately there seems to be a bug in the script since transparency is provided on the initial page load but ignored on subsequent hovers.

    Aside from these hurdles, this is a lovely menu with lots of flexibility. Still I appreciate any help I might get in solving my own small dilemmas.

    Reply
  51. I too love this dropdown but agree with some of the others. Ideally it should downgrade to a CSS only dropdown, something similar to Suckerfish or Son of Suckerfish.

    Reply
  52. Great tutorial, to bad the line from the jQuery JavaScript Library v1.3.2 makes this not to work with mootools 1.11

    There are some other great jquery dropdown menus that do work with mootools and jquery šŸ™‚ and are less than 2kb while this one is 45kb.

    Thank you for sharing the code

    Reply
  53. Can you please check the menu functioning when you make the drop down go slower ex. 600) and when you fast move the mouse out and back over the drop down it self!

    Reply
  54. I like it dudeā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦

    very cool drop down it isā€¦ā€¦ā€¦..

    thnxs for sharing with usā€¦ā€¦ā€¦ā€¦ā€¦ā€¦..keep it up.

    Reply
  55. If you look at the demo in IE 7, the menu aligns to the left as opposed to the center in Firefox and Safari. There are also slight positioning differences in IE as compared to Firefox if you start to modify the styles.

    Reply
  56. Great tutorial. However, the drop-down menus fall behind other elements in the page when running in IE 7. The z-index is set to 999 for the .dropdown in your CSS and I tried various values for the z-index on each element ā€“ still the same behavior.

    We have a jQuery news slider that appears below it and the drop menus fall behind the content. We replaced it with a simple div containing a background image ā€“ still the same result.

    Any ideas or suggestions?

    Reply
  57. Yeah, Iā€™ve run into not only other jQuery script conflicts that stop the dropdowns working, but also things like lightbox and lightwindow. Iā€™m getting a z-index issue in ie6 too, but thatā€™s probably just something buried in my CSS.

    Reply
  58. Great article and explanation of the basic menu and with the added abilities of the menu. I think this might be the menu I end up going with thanks to your very well written instructions for use.

    Reply
  59. Anybody run into a conflict with other jquery plugins on the same page? Dropdown functionality is lost when I add jquery cycle to the pageā€¦thank you.

    Reply
  60. Ten days have gone by, but nobodyā€™s responded to the post above. If itā€™s because the problem is a bit bewildering, then let me try to offer more information:

    This could be relevent: I always set my bodyā€™s font size to 62.5% for reasons I think everyone knows. Accordingly, all fonts seem to work just fine at approximately 1em ā€” or whatever.

    I note that the demo for this script displays typefaces the same in IE as they do in Firefox. But Iā€™ve modified my css a bit, mostly removing unused selectors.

    Could it be that Iā€™ve changed a selector thatā€™s critical to maintaining the font size in IE? To compensate for the larger font now displayed in IE, Iā€™ve tried a few CSS hacks. This works, of course, but it also creates a different problem: Applying essentially two different font sizes within the container now wreaks havoc with the containerā€™s height and placement.

    Help! Iā€™d sure appreciate a few thoughts from anyone who might be able to shed some light.

    Reply
  61. This menu was a godsend after I struggled for a week trying other similar ones. But I still have one issue:

    In restyling the css for my needs, Iā€™ve somehow affected one selector that now causes IE6 to display headings much larger than the intended size. Thereā€™s no problem with FireFox browsers at all.

    I should mention that all of the dropdown headings are fine on both browsers. Itā€™s only the main headings that render far too large in IE.

    If someone has encountered this and can suggest where Iā€™d look for a remedy, Iā€™m entirely grateful.

    Reply
  62. Ey! I loved this tutorial, but I kind of have a problem. I cant link some of the ā€œbuttonsā€, and I changed the pics and the ā€œdropdownā€ pic wont show..
    could anyone help me? šŸ˜€

    Reply
  63. Agree with Paulo ā€“ plus, the drop downs should open on a:focus in the CSS too, at the moment it only works on hover, making it keyboard-inaccessible.

    Reply
  64. Great article!

    One thing to watch out for is this solution requires javascript to open the sub-menus. Ideally we would want to update it to use pure CSS drop-downs (a la Sons of Suckerfish ) while adding the cool affects to those with javascript enabled. Sort of how the Superfish plugin does it

    Reply
  65. A great tutorial and easy to follow. Iā€™ve never really tried drop down menus on my sites but this tutorial will help a lot. Thanks.

    Reply
  66. Iā€™m a huge fan of jQuery and always wondered about the programming of the drop downs on your site ever since I saw your blog Brian. Thanks for the nice tutorial. I definitely picked up some really great tips for my next drop down menu.

    Reply
  67. Nice, I may have to nick this šŸ™‚

    Though it wouldā€™ve been nice to have the JS seperate from the plugin files.

    Reply
  68. iā€™m new to jquery but love how iā€™ve redesigned my site using it for horizontal display. this tut is glorious and easy to understand as well as tweek for my clientā€™s design wishes. good stuffā€¦keep it up.

    =^,^=

    Reply
  69. Thanks Brian (and WebDesignDev).

    Drop down menus are a mainstay of any serious web developerā€™s arsenal and most people have their own robust standard way of doing it.

    Despite this, there are still thousands of basic tutorials on how to hang them together ā€“ all doing things differently, and few nicely.

    I have not yet played with JQuery, and I must admit that was the only reason I looked at what I thought would be yet another rehash. I enjoyed reading a well written tutorial and seeing a well built base menu, that become easy to extend.

    Most of all, I am now inspired to explore JQuery further, as it no longer looks scary and new, or too complex for the low budget small business sites I do.

    Reply
    • Jquery is very easy. Just a few lines of code. I always go shopping on their website for my effects, and modify the code for what i want it to do. šŸ™‚

      Reply
  70. Thanks for allowing me the opportunity to write for WebDesignDev. I hope (and Iā€™m sure) people will love it šŸ™‚

    Reply
    • Hi,
      The Fanciest Dropdown Menu looks great.

      But I wondered whether you could help me.
      The menu in Dreamweaver is vertical even though in the browser its horizontal.
      This makes my layout in Dreamweaver look messy.
      Is there any code I have to add to rectify this.
      Thanks very much for any advice.
      Kind Regards, Len

      Reply

Leave a Comment