DHTML Lab - dhtmlab.com - Hierarchical Menus Ver. 3 - Addendum IX (v3.09) | 6 | WebReference

DHTML Lab - dhtmlab.com - Hierarchical Menus Ver. 3 - Addendum IX (v3.09) | 6


Hierarchical Menus Ver. 3 - Addendum IX (v3.09)
enabling menus for IE5 Macintosh

An item element's styling depends on styles applied to all menus (via the in-page parameters) or menu-tree-specific styles defined in the arrays. These style values are made properties of the menu element in our setMenuTree() function. Every item then grabs these values from its containing menu and uses them.

Therefore, every item must be able to identify its containing menu correctly. This identification is achieved with the following statement in our itemSetup() function:

function itemSetup(whichItem,whichArray) {
    this.container = (NS4) ? this.parentLayer : this.offsetParent;

IE5Mac doesn't like the offsetParent property, and possibly rightly so, since the menu items are not positioned elements but simple SPANs, that are not directly offset from their parent, but placed in the regular HTML flow. It may not like it because the offsetParent property has yet to be updated. Whatever the case, it does like the parentElement property.

Although they are two completely different properties, for our purposes offsetParent and parentElement are interchangeable. We therefore appease IE5Mac with the following change:

function itemSetup(whichItem,whichArray) {
    this.container = (NS4) ? this.parentLayer : this.parentElement;

Now, try the menus:

Menu Example 1:

Menu Example 2:

Menu 1
Menu 2

Well, it's happening, but the horizontal size on the first menu is off. What to do?

Produced by Peter Belesis and

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

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