Mega Drop Down Menus w/ CSS & jQuery

Blog » CSS/XHTML » Mega Drop Down Menus w/ CSS & jQuery

Mega Drop Down Menus w/ CSS & jQuery

PrintNovember 3rd, 2009

While in the process of redesigning 4wheelparts.com, I decided to explore new methods of working with our huge number of inventory and categories. I did some research and noticed a new trend for ecommerce sites in having what they call “mega drop down menus”.

According to usability expert Jakob Nielson, mega drop down menus tested to be more efficient for large scale websites. I decided to experiment with different ways of implementing this technique and would like to share how I achieved this method.

Given that regular drop-down menus are rife with usability problems, it takes a lot for me to recommend a new form of drop-down. But, as our testing videos show, mega drop-downs overcome the downsides of regular drop-downs. Thus, I can recommend one while warning against the other. – Jakob Nielsen – Alert Box

As I read his article he recommended that these kind of drop down menus should have a subtle time delay when hovering in and out of them. I decided to use the Hover Intent jQuery plugin to help me achieve this effect.

Mega Drop Down Menu - CSS & jQuery

Step 1. Foundation – HTML

Just like all of my navigation tutorials, start by creating an unordered list. Since we will be using CSS Sprites for our navigation states, each link within the list item should have a unique class name to it.

<ul id="topnav">
    <li><a href="#" class="home">Home</a></li>
    <li><a href="#" class="products">Products</a></li>
    <li><a href="#" class="sale">Sale</a></li>
    <li><a href="#" class="community">Community</a></li>
    <li><a href="#" class="store">Store Locator</a></li>
</ul>

Step 2. Styling Foundation – CSS

Since our drop down menu will be using absolute positioning, be sure to add a relative positioning to the list item. Shoot the text off of the page by specifying a text-indent of -9999px. We will then replace each navigation link with an image by specifying an image path to each link class name.

ul#topnav {
	margin: 0; padding: 0;
	float:left;
	width: 100%;
	list-style: none;
	font-size: 1.1em;
}
ul#topnav li {
	float: left;
	margin: 0; padding: 0;
	position: relative; /*--Important--*/
}
ul#topnav li a {
	float: left;
	text-indent: -9999px; /*--Push text off of page--*/
	height: 44px;
}
ul#topnav li:hover a, ul#topnav li a:hover { background-position: left bottom; } /*--Hover State--*/
ul#topnav a.home {
	background: url(nav_home.png) no-repeat;
	width: 78px;
}
ul#topnav a.products {
	background: url(nav_products.png) no-repeat;
	width: 117px;
}
ul#topnav a.sale {
	background: url(nav_sale.png) no-repeat;
	width: 124px;
}
ul#topnav a.community {
	background: url(nav_community.png) no-repeat;
	width: 124px;
}
ul#topnav a.store {
	background: url(nav_store.png) no-repeat;
	width: 141px;
}

Step 3. Creating the Mega Sub Navigation – HTML

Add a class of “sub” right after your main navigation link and nest unordered lists within. Each nested unordered list will act as the nav columns of your mega drop down.
Mega Drop Down Menu


<ul id="topnav">
    <li><a href="#" class="home">Home</a></li>
    <li>
    	<a href="#" class="products">Products</a>
        <div class="sub">
            <ul>
                <li><h2><a href="#">Desktop</a></h2></li>
                <li><a href="#">Navigation Link</a></li>
                <li><a href="#">Navigation Link</a></li>
            </ul>
            <ul>
                <li><h2><a href="#">Laptop</a></h2></li>
                <li><a href="#">Navigation Link</a></li>
                <li><a href="#">Navigation Link</a></li>
            </ul>
            <ul>
                <li><h2><a href="#">Accessories</a></h2></li>
                <li><a href="#">Navigation Link</a></li>
                <li><a href="#">Navigation Link</a></li>
            </ul>
            <ul>
                <li><h2><a href="#">Accessories</a></h2></li>
                <li><a href="#">Navigation Link</a></li>
                <li><a href="#">Navigation Link</a></li>
            </ul>
        </div>
    </li>
    <li><a href="#" class="sale">Sale</a></li>
    <li><a href="#" class="community">Community</a></li>
    <li><a href="#" class="store">Store Locator</a></li>
</ul>

Step 4. Styling Mega Sub Navigation – CSS

To get the sub nav to stick to the bottom left corner of the parent hovered nav, be sure to set an absolute position to the .sub container with the coordinate of top 44px and left 0px. For style, I added rounded corners to those browsers that support it (Firefox/Chrome/Safari).

Keep in mind when having multiple levels of nested lists, you need to override its conflicting properties. Check out the comments below.

ul#topnav li .sub {
	position: absolute; /*--Important--*/
	top: 44px; left: 0;
	background: #344c00 url(sub_bg.png) repeat-x; /*--Background gradient--*/
	padding: 20px 20px 20px;
	float: left;
	/*--Bottom right rounded corner--*/
	-moz-border-radius-bottomright: 5px;
	-khtml-border-radius-bottomright: 5px;
	-webkit-border-bottom-right-radius: 5px;
	/*--Bottom left rounded corner--*/
	-moz-border-radius-bottomleft: 5px;
	-khtml-border-radius-bottomleft: 5px;
	-webkit-border-bottom-left-radius: 5px;
	display: none; /*--Hidden for those with js turned off--*/
}
ul#topnav li .row { /*--If needed to break out into rows--*/
	clear: both;
	float: left;
	width: 100%;
	margin-bottom: 10px;
}
ul#topnav li .sub ul{
	list-style: none;
	margin: 0; padding: 0;
	width: 150px;
	float: left;
}
ul#topnav .sub ul li {
	width: 100%; /*--Override parent list item--*/
	color: #fff;
}
ul#topnav .sub ul li h2 { /*--Sub nav heading style--*/
	padding: 0;  margin: 0;
	font-size: 1.3em;
	font-weight: normal;
}
ul#topnav .sub ul li h2 a { /*--Sub nav heading link style--*/
	padding: 5px 0;
	background-image: none;
	color: #e8e000;
}
ul#topnav .sub ul li a {
	float: none;
	text-indent: 0; /*--Override text-indent from parent list item--*/
	height: auto; /*--Override height from parent list item--*/
	background: url(navlist_arrow.png) no-repeat 5px 12px;
	padding: 7px 5px 7px 15px;
	display: block;
	text-decoration: none;
	color: #fff;
}
ul#topnav .sub ul li a:hover {
	color: #ddd;
	background-position: 5px 12px ;/*--Override background position--*/
}

Step 5. Setting up jQuery & Hover Intent

For those who are not familiar with jQuery, do check out their site first and get an overview of how it works. I’ve shared a few tricks that I have picked up along the way, you can check those out as well.

Initial Step – Call the jQuery file

You can choose to download the file from the jQuery site, or you can use this one hosted on Google.

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>

After calling the jQuery file, visit and download the latest Hover Intent jQuery Plugin. Save the file to your current directory, and call the file.

<script type="text/javascript" src="jquery.hoverIntent.minified.js"></script>

Step 6. Launching Code on Document Ready

Directly after the line where you called your jQuery and hover intent file, start a new <script> tag and start your code by using the $(document).ready event. This allows your jQuery code to run the instant the DOM is ready to be manipulated. The code you will be writing in the next few steps will all take place within.

$(document).ready(function() {
	//Code goes here
});

Step 7. Set Hover Over & Hover Out Events – jQuery

Note: When using the hover intent plugin, it requires each hover over and hover out state to be in its own function.

The Logic

When a drop down parent link is hovered over:

  1. Find .sub and fade it in (By default, we will fade the opacity down to 0)
  2. Check if a .row exists (in case you want more than one row in the drop down)
  3. If .row does exists, find the widest row and set the width of the .sub container.
  4. If .row does not exist, set the width of the .sub container.

On hover out:

  1. Find .sub and fade it out (Opacity 0)
  2. Hide .sub (Display none – so it is completely out of the way)

The following script contains comments explaining which jQuery actions are being performed.

//On Hover Over
function megaHoverOver(){
    $(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
    (function($) {
        //Function to calculate total width of all ul's
        jQuery.fn.calcSubWidth = function() {
            rowWidth = 0;
            //Calculate row
            $(this).find("ul").each(function() { //for each ul...
                rowWidth += $(this).width(); //Add each ul's width together
            });
        };
    })(jQuery); 

    if ( $(this).find(".row").length > 0 ) { //If row exists...

        var biggestRow = 0;	

        $(this).find(".row").each(function() {	//for each row...
            $(this).calcSubWidth(); //Call function to calculate width of all ul's
            //Find biggest row
            if(rowWidth > biggestRow) {
                biggestRow = rowWidth;
            }
        });

        $(this).find(".sub").css({'width' :biggestRow}); //Set width
        $(this).find(".row:last").css({'margin':'0'});  //Kill last row's margin

    } else { //If row does not exist...

        $(this).calcSubWidth();  //Call function to calculate width of all ul's
        $(this).find(".sub").css({'width' : rowWidth}); //Set Width

    }
}
//On Hover Out
function megaHoverOut(){
  $(this).find(".sub").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
      $(this).hide();  //after fading, hide it
  });
}

Step 8. Set Custom Configurations & Trigger Function

Now that we declared the hover over and hover out function in the above step, its now time to set the custom configurations and call the hover intent function.

//Set custom configurations
var config = {
     sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
     interval: 100, // number = milliseconds for onMouseOver polling interval
     over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
     timeout: 500, // number = milliseconds delay before onMouseOut
     out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};

$("ul#topnav li .sub").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
$("ul#topnav li").hoverIntent(config); //Trigger Hover intent with custom configurations

For more detailed explanation of how hover intent works, check out their website.

Conclusion

Keep in mind that this script calculates the width of your .sub container (adding up all UL’s per row) and automatically adjusts it. If you would like to specify your own custom width, you can delete that portion of the code and specify a static width in your CSS. This all depends on what you are trying to add in your mega drop down, and each scenario may be different. I hope you grasped the basic concepts of this tutorial so you can make your own custom mega drop down for future projects. If you have any questions, concerns, or suggestions, please let me know!

Mega Drop Down Menu - CSS & jQuery

Inspiration Elsewhere

Now that you know how to create a mega drop down from scratch, check out some of these sites for inspiration.
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu

Related Articles

Did You Enjoy This Post?

subscribeSubscribe via RSS ,by email, or by twitter to get all upcoming
tutorials and articles delivered straight to you.

Bookmark or Share this Post!

  • Digg
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Twitter
  • E-mail this story to a friend!

Tags: , , ,

This entry was posted on Tuesday, November 3rd, 2009 at 12:29 am and is filed under CSS/XHTML. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

120 Responses to “Mega Drop Down Menus w/ CSS & jQuery”

  1. Marco

    Looks very slick – well done mate. With CSS3 you could even make “columns” instead of having three different lists. Still, this is a great example which could be used in loads of websites.

    Keep up the great work!

  2. Janko

    Awesome tutorial and really impressive demo. Great work, Soh!

  3. saurabh shah

    nice menu … was looking something like this only and got .. thanks for sharing it !

  4. nana

    Hmm… I cant see the drop down in the demo…only me?
    Using Chrome here..

  5. nomi

    wow …. dude you rock. excellent tutorial. thanks.

  6. James

    Excellent tutorial Soh! Clear and concise and I’ll be using this on future projects

  7. Mauricio Rivera

    Great tutorial! … I’ll keep it in mind if I ever need a fatty menu like this, surely I will.

  8. Robin B.

    Nice solution, thanks ;)

  9. Aaron

    EXACTLY what I was looking for! Thanks, this helps a bunch!

  10. designfollow

    thanks for the great tutorial.

  11. Rocco

    Damn ninjas… :P Nice job, btw.

  12. Jad Limcaco

    Very nice Soh! I have never tried something like this before, and I will definitely refer back to this on my next website that needs a big, fat, overweight dropdown menu. :)

  13. Terry

    Great work! Thanks for sharing.

  14. CIDIC

    what about browser compatibility will it work with anything?

  15. veeru

    It’s really impressive work. Thank you for sharing.

  16. Ackrock

    Love the tutorial, unfortunately i’ve had little success following any tutorials on this issue, i would love (and im sure others would too) if you can do a video tutorial on this subject i’ve searched the web up and down and haven’t found 1 video tutorial on this subject. Thanks Man.

  17. Sean Curtis

    Seems to work ok in most modern browsers (didn’t check IE6) – but why on earth didn’t you make it keyboard accessible? I can’t even tab through the menu at all…

  18. izulcybercafe

    Nice tutorial..

    Thanks…..

  19. Manny

    Well done, this is a great tutorial and IT WORKS GREAT IN IE6! to make round corners in IE6 i’ve had great success with this: http://www.dillerdesign.com/experiment/DD_roundies/ works a treat.

    M [".][",]

  20. Tim Taylor

    I would have a concern about the use of any dropdown menu used in IE6 when it comes to the menu flyout expanding over a select form element. Have you factored in bgiFrame jquery plugin into your code as well?

  21. Pat

    That is exactly what I was looking for. Thanks a lot!

  22. Jauhari

    Excellent and easy to try..

  23. mupet

    Great tutorials, impresive work

  24. James

    Soh, the tutorial is amazing. I was looking for something like that. In future can you make a tutorial on suckerfish menu with animation?

    Thanks

  25. Jacob

    sweet :)

  26. Rilwis

    Good article. I love the way you organize HTML codes. It’s simple and meaningful. I bookmark this for a good reference. Thank you.

  27. Alex Flueras

    Thanks so much! I was looking for weeks for an actual tutorial on MegaMenus. Great article!

  28. michael

    any chance of you making this 508 compliant?

  29. mini

    Very good tutoiral! Can someome tell me for which browsers is used -khtml-border-radius ?

  30. Silverboy

    how much I’ve been looking for something like this…..thanks :D :D

  31. Nadja Design

    Wow those menus are awesome, have been looking for something like this for ages!

  32. Rochelle Dancel

    Oh, wow – thank you for sharing this! Have bookmarked for future use… :)

  33. CMS Themes

    Wow, a great written tutorial mate. I will sure need this drop down menu on upcoming projects.

    Thanks

  34. Five Technology

    This is perfect for a few e-commerce projects we have coming up. Great post. Thanks.

  35. Ali Suarez

    Really useful! Thanks a lot!

  36. Placehold

    Thanks dude, Yet another killer tuts,

    Keep up the great work :)

    Regards

    Craig

  37. Lam Nguyen

    That’s sad when seeing this post in this blog because I planned to write a post about this one. However, I’m very impressed by the awesome tutorial by you. Thanks for your great post :D

  38. Tutorials

    I found your site on a tutorial directory. We recently launched tutorialgrad.com. It’s similar to those other tutorial sites only easier for you. All you have to do is submit your RSS Feed once, we do the rest. We will check your feed for tutorials and post them daily, all with direct links to your site (we don’t frame your content). If you are interested please check it out and let us know what you think.

  39. Gregor

    hey, nicely done!
    But for what do you need do you need the jQuery?
    All that I see in the demo can be done with CSS only these days (as long as you do not need to support IE 6 of course). Even the transitions.

    Good work anyway, and the people love it, you got featured by SM, congrats!

  40. Nick

    Great tutorial! Love the big drop downs…

  41. Rahul - Web Guru

    Very interesting drop down, which is being used quite widely these days in many popular websites too.

  42. theComplex

    Quite awesome, thank you for posting this!

  43. share

    function is possible to “active” in this menu? if so you could give some examples? or answer me please, greetings and thanks.

  44. Matt Propst

    Great article. I’m a huge fan of the tutorial (i’ve bookmarked the page) but was was hesitant of using the concept until i got down to the “real world examples” Ok, i’m sold. Now i just need a project to use the Mega Drop-Down on :-)

    Thanks!
    -Matt

  45. chandrakanta

    Boss. you are great. I am having 2 years of exp. in PHP and I like your tutorial. this is what I need. Cheers . :)

  46. Anne

    Great tutorial, thanks.
    I also liked the green header very much. Wat did you use to make the word “DROPDOWNS”?

  47. montana Flynn

    Excellent timing on this one Soh, a client specifically requested a mega menu!

  48. Hung Bui

    Very nice tutorial and quit useful.
    In my opinion, I would change the hover effect a bit that when hover to other tab the existing mega drop down hide it immediately and show a new one. However, when user move the mouse out of mega dropdown then you can have a subtle time delay.

  49. Anderson

    Fantástico!

  50. Jim

    Thanks for the tutorial! Will be using this in conjunction with a redesign of our business website shortly!

    Cheers! :)

  51. matt

    Great summary! Just in time for our meganav implementation. Kind of crazy how much influence Nielsen has. Seriously though, this would have been a good article even without the resizing portion of the script, but it’s always nice to throw in something a little extra.

    In my laziness I did not realize you could call multiple sets of configurations for hoverIntent. No decent dropdown menu should be without it imo.

  52. George

    Fantastic demo – seems to have stopped working in IE though – might be me, but could someone check? :o )

  53. Mickaël

    Ce blog est décidément une véritable mine d’or !
    Merci pour le tuto !

  54. WPSMASH.COM

    Thank you for this great tutorial!

  55. Nuramon

    Very nice Tutorial!

    Please note, when using the code from this site, the line:
    rowWidth = $(this).width();
    …should increment the widths:
    rowWidth += $(this).width();

    In the demo it’s correct and working. :)

  56. Eric

    Thank you for the great tutoiral and working example! I am trying get the megamenu to display on top of some other elements on my page and having trouble figuring out the z-index levels. Anybody else having issues with the menu being displayed behind other elements on your page.

  57. Gabby

    Nuramon I LOVE YOU!!!
    I have been trying to wrap my brain around what I could have done wrong or where the slight difference could be as my uls were just one big list no matter what I did.
    Next time you’re in Edmonton, Canada I will buy you a drink :)

  58. Soh

    Sorry guys/girls!! That was my bad X-p

    @Nuramon Thanks very much for pointing that out, not sure how that portion got deleted :-p

  59. Rick Dawson

    Thanks for putting this up. It’s just what i’m looking for :)
    The first mega drop down menu that has all features and holds it’s mouse state when over the drop down.
    I found a few tutorials/scripts before which lost the mouseover state when over the drop down.
    I’m trying to get this working for a site that has a fixed width.
    I cannot get the background (body_bg.png) to repeat, if the design has a fixed width (970px)
    http://me.richarddawson.co.uk/menu2

    I’ve even moved the background to it’s own DIV and set the BODY to 970px

  60. Soh

    @Rick, you can just add a overflow: hidden; and you should be good to go~

  61. Alexandre Cruz

    Excellent tuto.

    I´m your follower now. I´ve never see ur blog, excelent, excelent, excelent, excelent !

    continue working in this, i loved

  62. tylerr

    Hi, Soh! Let me say that your Mega Menu is just fantastic!
    There are a few solutions out there, but none with simplicity and effectiveness of Yours…

    I’d like to tweak a bit, but haven’t been able to do so… Wondering if you could help…

    I’d like for the sub-nav to spread to the full-length of the menu, whatever menu option is hovered on… I this case 960px.

    Conceptually, something like this:
    http://www.moosejaw.com

    Thanks in advance, Soh…
    Best Regards, T.

  63. greyk50

    Wow… you can always get cool stuff from Soh’s blog, keep up man, you ROCK!!!!

  64. J DesigN

    I like this menu, thank you

  65. CloneDVD

    Thanks for sharing this wonderful articles. Great jobs!
    I have marked it for future references.
    thanks again.

  66. shab

    Hello, i’m a french guy and i’m congratulate you for this very nice menu.
    However, i’ve a question.
    When i tried to put a background png in sub level to get a transparency, it doesn’t work in IE.
    Because of the function “function megaHoverOver” that make mine sublevel totally opaque.

    Please i need some help!

  67. kels

    Hey Soh what if I didn’t want it to fade in how would I do that?

  68. Can Karpat

    How can i use this menu with only text menu.. Not png?

  69. Jegan

    hey when we use the png fix then we have to use png fix for IE6. is there any other way.

  70. izdelava spletne strani

    Cool, i was just looking around a drop down menu for my new web site and these first one does it. It’s perfect!

  71. Ian Lloyd

    It looks lovely. Nice and semantic … but what happens if I don’t/can’t use my mouse? Erm …

    If you could update the jQuery to make it keyboard accessible – which should be simple enough to do – that would be a really good improvement to it.

  72. Kiran

    Great Navigation, I love it.

  73. kels

    @Can Karpat: Just don’t use the

    text-indent: -9999px;

    and you will be good.

  74. Benji B

    Tested in ie6/7/8 firefox PC/Mac and Safari Mac. Works identically :)

    @kels
    cheers for the tip. Saved me going down the wrong IR path.

  75. Benji B

    oops misunderstood kels post. Disregard last sentence of previous post.

  76. rahman

    great tutorial…
    thanxs a lot..
    good job, its give me inspiration..
    thanx thanx thanx xD

  77. David

    Fantastic tutorial. Anyone having a hard time with the z-index of the menus? They appear behind other objects on my page.

  78. Barry

    Great post. Thanks a lot, for making our life simple. We have started to apply your example in our website.

  79. Erik

    David,

    Having the same problem with the z-index….. Did you figure it out/

    Erik

  80. Erik

    OK, I figured it all out. BUT. How do you reverse the direction of the popup menu when it’s too far to the left? Really stuck on thisone..

    thanks.

    Erik

  81. Moth

    Great mega dropdown! Just used it on a site and it was easy set up.
    Just one issue I’m having:
    When I am on the actual page of the navigation that the dropdown “drops” from it doesnt’ work.
    So if it drops down from my “servieces” link and I am on the services page the dropdown doesn’t show up?
    Any ideas of why? or how I can change this?
    Thanks so much!

  82. D

    Erik, you say you’ve figured out the z-index issue…mind sharing with the rest of us who are stuck on that? :\ Would really appreciate it!

  83. Melissa

    Erik,

    You said you figured out the z-index??? I have been working on it for days with no luck. What did you do? I am using the menu differently than a linear menu it is more like a flyout and it works in everything except IE 6 and 7 what did you do? My example http://www.okaloosagas.com/newsite/working.html.

    Thanks :)

  84. Andrew

    Hey thanks for the great tutorial. Using this in a project that I am working on.

  85. Terje Otto

    I love the mega drop down menus! But :P Can you make a tutorial on how to use it with wordpress?

    In particular with wp_list_pages(); si that I can assign parent pages and grand parent pages so it will mimic the looks of the one you have in demo here.

    REALY hope you can help me on this one! have been working on this for almost two whole days now :P

    Marry Christmas!

  86. Erik

    Hi D, Melissa, and everyone,

    I spoke too soon.. i thought everything was going great until I saw my work in IE6 and IE7…. But We will find a solution. Here is my work so far: http://www.naturalskin.com/home1.htm.

    I wish we could hear from the master…

    Erik

  87. Erik

    Fixed the problem by using a hight z-index for the ul#topnav li .sub. Works fine.

    Erik

  88. Neha

    Great work with easy coding.

  89. Adi

    Hi,

    In IE(all versions) the hover state of each main nav element is disappearing as mouse goes to sub-menu.In mozilla this is goin perfect.
    So after checking in both browsers I think IE is not recognizing the following (hover state) style which is -
    ul#topnav li:hover a{ background-position: left bottom; }

    SO please suggest me the modifications to run this hover state in IE .
    please help…

  90. Melissa

    Hey Erik,

    Just saw your post and jumped back into my code in hopes that would help. Unfortunately my z-index on that ID was alread set to 30000…I think that is pretty high. I am sure it has to do with the way I am trying to use the menu. Since I need it to be positioned over other menu items instead of other content on the page…I may need to go back to the drawing board.

    Thanks :)

  91. marco

    how to make a multilevel menu with this script?
    thansk

  92. mybb

    Thanks…..

  93. Vinidog

    Nice, nice, nice…

    Great job guy!!!

    ;-)

  94. Bucky

    Thanks for the great tutorial! Just wondering, how do I get a semi-transparent PNG dropdown to work in IE? It works fine in Chrome & Firefox but not IE7 and 8.

  95. Schweiz

    Have these implemented and are working great. I’ve got a 950px fixed-width layout and when my browser window is resized to the dimensions of most users, the dropdown on the far right side goes off the page.

    Any way to have this particular menu have the sub-navigation be aligned to the right edge of the wrapper so it stays within the viewable area?

    I’m guessing I can specify a .class for the particular menu and do it? Anyone else have this issue and fix it?

    Cheers!

  96. Betty

    Really great post, thanx! I was looking for a tutorial on mega dropdown menus, and this one seems the most appropriate. I’ll give it a try at once.
    Greetz, Betty

  97. Julia

    Please help, repeated, but “How do I get a semi-transparent PNG dropdown to work in IE? It works fine in Chrome & Firefox but not IE7 and 8.”
    Please help…..

  98. Julia

    One solution for transparent background in ie7, ie8 it’s to add .css(’filter’, ‘none’)
    will have
    $(this).find(”.sub”).stop().css(’filter’, ‘none’).fadeTo(’fast’, 1).show();
    instead of
    $(this).find(”.sub”).stop().fadeTo(’fast’, 1).show();
    But it cancels out the fadeTo in IE…

  99. Daniel Winnard

    Hi,

    This is a great tutorial, one which I have implemented into our site. One question though for you CSS savvy guys. What would I have to do to get the sub part to appear above divs after the navigation? Is this a Z-index job?

  100. Matt

    Anyone having any trouble with IE not formatting the UL’s into two columns in the menu? That’s what’s happening on mine. You can see an example of it here: http://www.gallsdirect.com/gwebc/menus/menu2/menu2.html

    (P.S. Only the first item in the menu is actually ‘linked’ – the rest is a flat graphic. It’s just for testing purposes at this point.)

  101. tylerr

    In need of a small fix: How to make the mene NOT fade, but simply show/hide?

    To clarify, how to “remove” fadeTo from the following code:

    function megaHoverOver(){
    $(this).find(”.sub”).stop().fadeTo(’0′, 1).show();
    ————-
    function megaHoverOut(){
    $(this).find(”.sub”).stop().fadeTo(’0′, 0, function() {
    $(this).hide();
    });

    Soh, can you support a bit?

    Thanks in advance to all!
    T.

  102. Irene

    Wow, Great!

  103. Stefan

    Erik,

    Did you already figured out how to reverse the direction of the popup menu when it’s too far to the left?

    Thanks!
    Stefan

  104. Jamshed

    It is awesome dude!

    i was waiting for this for long time

    thnx.

  105. Dean Perry

    Another inspiration site could be http://tv.adobe.com

  106. Áki

    thanks man, awesome

  107. Áki

    @tylerr:

    this works for me:

    function megaHoverOut(){
    $(this).find(”.sub”).hide();
    }

  108. Aravind

    It’s so nice…..thanks….

  109. Matt

    Stefan, Erik – I’m also trying to figure out the problem of having the menu float out too far to the left. I’ll post solution here if I figure it out, and hopefully you can do the same. Or maybe someone can assist us with this? I’ll say this – simply adding a CSS class (like .subleft) isn’t enough since the script depends on that class being called ’sub’ and it will break the functionality on your menu if you re-name it. I suspect I will have to add elements to the script as well to fix this. I will begin experimenting.

  110. Stacy

    Great! Thankyou!

  111. All Web Services

    What a nice menu and a great tutorial, this is what the big online shops use.

  112. Greg K

    Can you please show us how to make the “active state” work in this tutorial? I’ve read your other article and can’t seem to combine the two to work together. Any thoughts?

  113. Steve

    Absolutely fantastic script, fine work! I’ve used and adapted the script here … http://www.uprint.me.uk – one of the best Jquery scripts i’ve used. Thanks for all your effort.

  114. Ahmad Ali

    mmhh nice but why when i mix with Mootools its wont work ??

  115. Ayman Aboulnasr

    Great work, thanks alot for sharing.
    By the way, Christian Watson of http://www.smileycat.com has gathered 29 examples worth seeing Mega Drop Down Menus here:

    http://www.smileycat.com/design_elements/mega_dropdown_menus/

  116. Roelof Wobben

    Hello,

    I try to make this work on this test site. But it don’t work.
    Can you help me where things are going wrong here ?

    Roelof Wobben

  117. Russ

    Great Work!!

    I think you have done well to make this look nice..However, I have to say I am not too keen on how the menu fades.

    I think it should completely disappear before showing the next menu as otherwise it serves as a distraction.

    But that is just the first impression I got of it.

    Definitely very nice though!

    Good work..

  118. Steve

    Russ > You can alter the speed at which the transition happens to make it much faster or no transition at all. A great script all told.

  119. James

    Nice script, but I have a little problem that when I hover over the menu the drop down seems to make the whole part move to the left ?

  120. Dirk

    @Erik,

    You made me happy. The z-index in ul#topnav li .sub works pretty fine.

Speak Your Mind…

Need to post HTML code?
Use Postable for your convenience.

Don't have an Avatar?
Set up a Gravatar image now!

Blog Blog Categories

Popular Comments Popular Posts

Recent Comments Recent Comments