DHTML Lab: Hierarchical Menus Ver. 3 - Addendum (v3.01) | WebReference

DHTML Lab: Hierarchical Menus Ver. 3 - Addendum (v3.01)


Logo

Hierarchical Menus Ver. 3 - Addendum (v3.01)
easing the burden on Navigator for UNIX

Sample Menu

Click the link above to reveal sample menu.

Thanks to Mark Sanderson and Marty Blase for bringing this problem to my attention.

Special thanks to
Tony Le, a struggling student at UC Berkeley, for spending a Sunday afternoon running the script on several Unix flavors.

HierMenus
CENTRAL
IMPORTANT NOTE:
This column introduces a new version of the hierarchical menu script. All information is valid at the time of writing. New browser versions released after publication may not behave as outlined. The script is constantly under revision, with new features added, problems fixed and new browser versions addressed.
Read this column, and future columns, to learn how we built the menu script.
Use the most recent version of the script, always available in HierMenus Central.

This is a problem(bug)-fix .
You must be familiar with the script for Hierarchical Menus Version 3 to appreciate the discussion.

The Symptom

Feedback from UNIX users of Hierarchical Menus, Version 3, revolved around this issue:

"The browser displayed the first menu, highlighted two or three items as my mouse moved and then crashed."

The Diagnosis

Luckily, the source of the problem was easy to trace: the new NSfontOver parameter:

NSfontOver

Netscape Navigator does not support dynamic font color change. We can "fake" a color change, however, by replacing the complete contents of a positioned element, changing only the font color. Since this method can slow a system down, it is included as an option. Set to true, for NS4 mouseover font color change; false for no change. IE4 will change the font color to the value of overFnt, regardless of this parameter's value.


column21

As stated above, this parameter is included as an option, unlike the IE4 counterpart, because it slows down response-time. It was created after much reader demand.

The Treatment

It seems Navigator for UNIX does not like the constant element content updating. If NSfontOver is set to false, the problem disappears.

We, therefore, add these two lines to the beginning of our hierMenus.js script:

isWin = (navigator.appVersion.indexOf("Win") != -1)
if (!isWin && !isMac) NSfontOver = showVisited = false;

The first statement creates the isWin variable, true if the browser being used is a Windows browser.

Earlier, our in-page script had created the isMac variable to identify Macintosh browsers. A browser that is neither Windows nor Macintosh is a UNIX browser:
if (!isWin && !isMac).

For UNIX browsers, we set the value of NSfontOver to false. Notice that another potential trouble- maker, showVisited, is also set to false, as it, too, is slightly "unconventional."

The Results

If you want your Navigator users to have a font color change upon menu item mouseover, they still can, if they're using a Windows or Macintosh browser. UNIX visitors will simply not have this feature enabled.

The New Version

This script addition creates the first "maintenance" version of Hierarchical Menus. We have named it version 3.01, and it is reproduced on the next page in full. Please update your present version.


Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: Sept 20, 1998
Revised: Sept 20, 1998

URL: https://www.webreference.com/dhtml/column21/addendum/