|
home / issues / issue #28
| Issue: | PopUp Menus with ClickStart Cannot Be Reused Across Links |
| Browser: | All |
| Platform: | All |
| Description: | Normally, the new
configuration design of HierMenus allows any individual menu to be reused in a
different menu tree as needed; provided the two usages would never cause the
menu to be displayed twice in the same page at the same time. This feature,
however will not work for top level PopUp menus--i.e., menus that are tied to
in-page links--that are also set to be ClickStart
menus--i.e., menus that will display when their corresponding link is clicked.
Attempting to reuse top level ClickStart popup menus will result in--at best--the
latter of the two links not working at all, and at worse erratic behavior for both
the menu and links in question. |
| Cause: | This is a confirmed design
flaw in the HierMenus code. |
| Workaround: | You can work around the
problem by adding a small custom function to your pages and setting up the top level
menu in question using the onclick attribute of the links, instead of the
onmouseover attribute. Specifically:
At the top of each page, when you define your dummy functions for HM_f_PopUp
and HM_f_PopDown, add the following function declaration:
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
function HM_fc_ClickPop(){return true};
Add the following custom function to your pages. Note the simplest way to add
it to your pages is to add it to HM_Loader. This must be added at a
point below the above dummy functions (or you could simply add this instead
of your dummy function. But if you add this function to HM_Loader, it is
best that you keep the dummy function declaration as mentioned in step 1):
function HM_fc_ClickPop(menuid,event) {
if(typeof(window.HM_f_SetKeyWords)=="undefined") {
return true;
}
else {
HM_f_HideAll();
HM_f_PopUp(menuid,event);
return false;
}
}
Note that if you are using the optimized code set, this function will look like
this:
function HM_fc_ClickPop(menuid,event) {
if(typeof(window.HM_f_SetKeyWords)=="undefined") {
return true;
}
else {
HWn();
HM_f_PopUp(menuid,event);
return false;
}
}
Change your link setups--the links that will popup the menu--to look like this:
<a href="http://hiermenuscentral.com"
onclick="return HM_fc_ClickPop('hm_menu1',event)"
onmouseout="HM_f_PopDown('hm_menu1')">HMC</a>
<a href="http://anothersite.com"
onclick="return HM_fc_ClickPop('hm_menu1',event)"
onmouseout="HM_f_PopDown('hm_menu1')">HMC 2</a>
Finally, set the top level menu(s) that you will be reusing to ClickStart:0.
Since you are using onclick, you need to bypass HM's own internal ClickStart
behavior, which is what causes the problem in the first place.
For a working example of the above, see this page. |
| Posted: | June 16, 2005 |
|