Hiermenus Go Forth, XIX - DHTML Lab | 5 | WebReference

Hiermenus Go Forth, XIX - DHTML Lab | 5


Hiermenus Go Forth, XIX:
Version 4.0.12 - The Complete Script (Full-Window)


There have been many requests for a timer variable similar to HM_TopSecondsVisible but for child menus.

Currently, if HM_ClickKill is false, the menu tree collapses immediately upon user mouseout. Only the top-level menu remains visible, depending on the value of HM_TopSecondsVisible.

Since such a parameter is easy to implement, I have included it in 4.0.12 and not waited for a major release.

HM now recognizes the HM_GL_ChildSecondsVisible and HM_PG_ChildSecondsVisible parameter variables. If neither of these parameters are declared, the value for HM_ChildSecondsVisible defaults to .3, that is 300 milliseconds.

Note that, like HM_TopSecondsVisible, HM_ChildSecondsVisible takes a "seconds" value. A conversion to milliseconds is performed internally by HM.

Now, if a user mouses out of a menu tree, and HM_ClickKill is false, the tree will not collapse immediately, but only after the time specified in HM_ChildSecondsVisible has elapsed. If, during that time, the user mouses back onto the menu tree, the timer is, of course, cancelled.

Better Centering

In Version 4.0.9, when we improved JavaScript expression handling for menu positioning, we provided a "courtesy" function, HM_f_CenterMenu(), to help authors center permanent top-level menus on the page.

HM_f_CenterMenu() is not part of HM, but just an example of the type of function one can create and call from the positioning parameters. We included it in HM_Loader.js, and many authors are using it.

Currently HM_f_CenterMenu() centers a top-level menu regardless of menu width and window width. That is, if the menu is wider than the window, the menu is still centered in the page, with the menu's left edge positioned outside the window to the left. This is not desired, as the standard behavior of centered HTML elements is that they are centered as long as the window width allows. If the element is wider than the window, the element is left-aligned. HM_f_CenterMenu() has been modified to left-align the menu to a "minimum left pixel position" which you can specify.
Thanks to Adrien Constant for pointing out this behavior.

function HM_f_CenterMenu(topmenuid) {
	var MinimumPixelLeft = 0;
	var TheMenu = HM_DOM ? document.getElementById(topmenuid) : HM_IE4 ? document.all(topmenuid) : eval("window." + topmenuid);
	var TheMenuWidth = HM_DOM ? parseInt(TheMenu.style.width) : HM_IE4 ? TheMenu.style.pixelWidth : TheMenu.clip.width;
	var TheWindowWidth = HM_IE ? document.body.clientWidth : window.innerWidth;
//	return ((TheWindowWidth-TheMenuWidth) / 2);
	return Math.max(parseInt((TheWindowWidth-TheMenuWidth) / 2),MinimumPixelLeft);

Improved JS Expression Handling in Item Parameters

Version 4.0.12 also improves the handling of JS expressions used to define the

item array element parameters.

Files Changed in Version 4.0.12

You will need to overwrite previous versions of the above files to upgrade to 4.0.12.

HM_Loader.js has also been changed to include the HM_GL_ChildSecondsVisible parameter and the HM_f_CenterMenu() modifications. Both are optional, so your HM_Loader.js should be updated only if you have need to use either of them.

On the next page, the sample page included in the download.

Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: June 12, 2001
Revised: June 12, 2001

URL: http://www.webreference.com/dhtml/column55/4.html