Click to See Complete Forum and Search --> : HierMenus 4.2 hiding menu layer


webtekie
11-17-2003, 02:12 PM
Hello,

I am using HierMenus v. 4.2 on my site. I generate HM_Arrays.js dynamically through a Java class. The problem is that sometimes Java takes too long to create HM_Arrays.js, HTML content is loaded faster and as a result I am left with no menu. I tried to include a refresh directive for a page so that page is reloaded after 1 sec and hopefully HM_Arrays.js had loaded by that time -- but do not really like this approach.

I was thinking about putting the whole menu in a layer and initially hiding this layer, but then show it once HM_Arrays.js had been created. However, menu IS a layer so putting it on another layer doesn't really do anything.
Any suggestions on how can hide/show menu?

thanks,
webtekie

Jona
11-17-2003, 03:27 PM
onload = function(){
&nbsp; &nbsp; document.write('<scr'+'ipt type="text/javascript" src="HM_Array.js"></scr'+'ipt>');
}


[J]ona

webtekie
11-17-2003, 04:04 PM
can you explain what will this do?

thanks,
webtekie

Jona
11-17-2003, 04:46 PM
After the page loads, the function will write out a code to call your JavaScript heir-menus. You'll need to add another document.write() for your second .js file. I do believe HierMenus automatically waits for the document to load before it intializes, but that was the only thing I could think of. You do know the difference between Java and JavaScript, correct? Could you provide a link to your page?

[J]ona

dragle
11-18-2003, 08:23 AM
Hiya,

Are you saying your HM Arrays are being generated after the page load? That's somewhat of a problem, since the HM scripts do assume that the arrays are in place by the time they (the scripts themselves) are loaded. Jona is correct in that the menus themselves are not physically created until after page load; but the script itself does do some preprocessing of the arrays when it (the script) is initially loaded. The script doesn't do a lot of preprocessing, though, so it's possible with a little customization that these tasks could be moved into a function.

But I'm not 100% sure such a customization is absolutely necessary. I may be missing something here, but if the arrays are generated via some type of server side call, then you should be able to correct the problem by just ensuring that that call takes place before the scripts are loaded. (?) All the HM processing takes place client side, so as long as the arrays are created and sent to the browser before the scripts are loaded there shouldn't be a problem.

Either way, feel free to post a link and/or further information and we should be able to get to the bottom of it.

Cheers!