Skip to main content
GameDev.net gamedev.net
🔒 Locked

Menu bug (solution included)

Started by Wan Oct 22, 2007 at 5:57 PM 1 replies 1.7k views
Original Post
Wan
Wan
For quite some time there has been a bug in the top menu. In IE7 (and probably in earlier IE versions as well), whenever the mouse pointer leaves an expanded menu, the following error is thrown. Multiple times in a row. I haven't had much problems with it since I usually stick with FireFox, but it's very annoying in cases where you are only able to use Internet Explorer. I think this issue has been brought forward on of or more occasions in this forum, but is still unresolved. Hopefully explaining the problem and its fairly simple solution will change that. Looking at the code in menu.js the problem is caused by the following two lines:
setTimeout (closeMenuOpt(this), 120);
setTimeout (closeMenuOpt_Sub(this), 50);
There are two issues with this code: 1 - IE wants the first parameter to be enclosed by quotes. If not, it gets angry. 2 - In general, the first parameter should contain an expression to be evaluated after the number of milliseconds specified by the second parameter has passed. By leaving the expression unquoted there's nothing to evaluate, and thus it will execute immediately. In other words, setTimout doesn't serve any purpose here, the collapsing of the menu is not delayed. So since it causes IE to throw an error, it might as well be entirely removed:
<strike><font color="#999999">setTimeout (</font></strike> closeMenuOpt(this) <strike><font color="#999999">, 120)</font></strike>;
<strike><font color="#999999">setTimeout (</font></strike> closeMenuOpt_Sub(this) <strike><font color="#999999">, 50)</font></strike>;
acidwillburnyou
acidwillburnyou
Quite possibly the best suggestion I've ever seen on this forum [grin]
jbadams
jbadams
I believe there was actually a CSS replacement for the menu which didn't use scripting at all floating around at some point and even tested on the live site for a short time, I've no idea what happened to it though.

Fixing the script would be a nice option if that other version of the menu has vanished into the aether though.
- Jason Astle-Adams

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.