DHTML Lab - dhtmlab.com - Hierarchical Menus Ver. 3 - Addendum IX (v3.09) | 5
Hierarchical Menus Ver. 3 - Addendum IX (v3.09)
enabling menus for IE5 Macintosh
Let's first try to fix the menu element size. Why the last menu has bad vertical sizing cannot be logically traced in the script. We never set the size. The vertical size is determined by the content.
If we try to do some simple debugging, like determining what IEMac thinks the vertical size is (by displaying the offsetHeight or scrollHeight properties of the menu element in an
In the
function menuSetup(hasParent,openCont,openItem) { ... if (NS4) { ... } else { ... this.fullHeight = this.scrollHeight; ... } }
This statement determines the height of the menu element (this.scrollHeight) and stores it for future use in a custom property (this.fullHeight) used to position displayed menus within the browser window in the keepInWindow() function. We also found that the scrollHeight property was not updated in time for this assignment, but that the offsetHeight property was. For our purposes these properties are interchangeable, so we make these modifications to the function:
function menuSetup(hasParent,openCont,openItem) { ... if (NS4) { ... } else { ... this.fullHeight = this.offsetHeight; if(isMac) this.style.pixelHeight = this.fullHeight; ... } }
We determine the real height of the element, then we size the element by assigning this value to the element's style using the pixelHeight property, if a Mac is being used.
Try the menus again with the modification in place:
Menu 1 | ||
Menu 2 |
Ok, we're getting the vertical size, but the horizontal size of the first menu is too wide, and we still have no display of items.
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.Created: June 16, 2000
Revised: June 16, 2000
URL: https://www.webreference.com/dhtml/column21/addendum9/3.html