/    Sign up×
Community /Pin to ProfileBookmark

HierMenus 4.2 hiding menu layer

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

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@JonaNov 17.2003 — [font=monospace]

onload = function(){

&nbsp; &nbsp; document.write('<scr'+'ipt type="text/javascript" src="HM_Array.js"></scr'+'ipt>');

}

[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@webtekieauthorNov 17.2003 — can you explain what will this do?

thanks,

webtekie
Copy linkTweet thisAlerts:
@JonaNov 17.2003 — [font=arial]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?[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@dragleNov 18.2003 — 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!
×

Success!

Help @webtekie spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...