Hiermenus Go Forth, XIX - DHTML Lab | 5
Hiermenus Go Forth, XIX:
Version 4.0.12 - The Complete Script (Full-Window)
HM_ChildSecondsVisible
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) { //4.0.12 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; //4.0.12 // 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_is_rollover,
- item_permanently_highlighted, and
- item_has_child
item array element parameters.
Files Changed in Version 4.0.12
- HM_ScriptNS4.js
- HM_ScriptIE4.js
- HM_ScriptDOM.js
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
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: https://www.webreference.com/dhtml/column55/4.html