Blog > Fixing an IE 7 bug in mm_menu.js navigation

February 16, 2007
Martin Kuplens-Ewart
We're proud (even stubborn) hand-coders, so we don't often get the opportunity to delve into the JavaScript libraries deployed by using applications such as Dreamweaver.

Recently, however, we were contacted with an IE7 bug: a navigation system that was using the mm_menu.js library appeared to be only showing the first word of each option.

At 800 lines of dense JavaScript, this was not going to be fun to debug. Fortune, however, smiled upon us in the form of an invidual named Hiroto, who posted the following on the Cre8asite Forums:

function writeMenus(container) {
    .... some code here ....
    menu.menuItemHeight = menu.menuItemHeight || defaultHeight;
    var itemProps = ''; <= CHANGE THIS LINE TO => var itemProps = 'white-space:nowrap;';
    if( menu.fontFamily != '' ) itemProps += 'font-family:' + menu.fontFmaily+';';
     .... some code here ....
}

You should find this spot around line 163 of mm_menu.js. The change worked a charm. Thanks Hiroto!

Posted by Martin Kuplens-Ewart on Friday, February 16, 2007 at 01:15 PM in HTML/CSS with tags , , , , , , , , Permalink7 comments

Comments

cHEk says:
Worked like a charm

was at line 136 for me on mm_menu 6.0.

Seems they should publicly release a new version.

Thanks,
cHEk

Posted by cHEk on Tuesday March 27, 2007 at 11:16 AM
Colin Prince says:
Hi Martin,

Worked like a charm for us, we were using the term "Stir-Fry" and IE7 was breaking (wrapping) the line at the hyphen.

Thanks,
Colin.
Posted by Colin Prince on Tuesday March 27, 2007 at 2:37 PM
Shlomo says:
Thanks a lot, very helpful
Posted by Shlomo on Thursday April 19, 2007 at 7:09 AM
bruce says:
AWESOME!

Saved me HOURS!

going to have check this site more often...

thanks much.
Posted by bruce on Friday May 11, 2007 at 9:42 AM
Andy says:
Fantastic. I'd also like to add one other problem I found and the solution :)

In MM_showMenu, line 554 on mine was the second of these lines:
} else if (FIND("menuItem0")) {
var l = menu.menuLayer || menu;

This was erroring in IE7 (error about menu.menuLayer) if I had a top-level menu item with no sub-menu. I was using this for a Contact page. The solution was to put in

} else if (FIND("menuItem0")) {
if( menu )
{
var l = menu.menuLayer || menu;
...
}
else
hideActiveMenus();
}
Posted by Andy on Friday May 25, 2007 at 5:49 AM
Stray(AFO) says:

You rock Hiroto and Martin! Just saw that bug on a site of mine before the client noticed, and BAM, got it fixed with that line.

No one will ever know...hehe.

http://www.radiantcore.com bookmarked.

Posted by Stray(AFO) on Wednesday December 5, 2007 at 8:57 AM
Dan says:

Thanks, worked a treat! One of the first results in Google for "mm_menu IE7"

Posted by Dan on Monday January 14, 2008 at 6:56 PM

Post a New Comment

Please note that comments are moderated to prevent abuse of the comment system and will only appear after they have been approved by the author of this post. Use the "View Source" mode to edit HTML directly if you're into that kind of thing. We might not approve posts that are offensive or really off-topic, and we will definitely delete spam (and place nasty, nasty curses on the spammers).

Name
Email Address
Website
Comment