DHTML Lab - dhtmlab.com - Hierarchical Menus Ver. 3 - Addendum X (v3.10) | 4 | WebReference

DHTML Lab - dhtmlab.com - Hierarchical Menus Ver. 3 - Addendum X (v3.10) | 4


Hierarchical Menus Ver. 3 - Addendum X (v3.10)
quieter menus for Navigator

The Solution

...is, as you've guessed, simple and painfully obvious. Instead of rewriting the contents of an item layer when we need to change "look", we can simply create two layers, each containing a different font color, then toggle their visibility to produce the rollover. Just like we do when we make menus appear and disappear. Try it:


If you're using Navigator, you'll notice that the rollover works as expected, but "quietly."

Code Changes

Let's go through the hierMenus.js changes necessary to achieve stable, "quiet" menus:

First of all, NSfontOver, is deprecated as a parameter. Navigator will always display a font color change. You do not have to omit the parameter from your pages. The external script will simply ignore it.

Early in our script, we have this statement:

if (!window.menuVersion) {
    clickKill = NSfontOver = keepHilite = clickStart = false;

Here, we check for Version 3.x parameters that may not be declared, if the author was still using Version 2 parameters.

To keep our code clean, we omit NSfontOver from the assignment chain, to get:

if (!window.menuVersion) {
    clickKill = keepHilite = clickStart = false;

Further down, we have the statement that assigns false to NSfontOver, for Unix visitors:

if (!isWin && !isMac) NSfontOver = false;

We omit this statement completely, since Unix users will no longer have a font color problem with our layer-swapping solution.

Next, we modify the menu item layers.

Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: June 27, 2000
Revised: June 27, 2000

URL: http://www.webreference.com/dhtml/column21/addendum10/4.html