Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:33
positioning in cell
Poster: camz
Dated: Monday April 21 2003 - 18:19:33 BST
hello
i used the following code to position the bar in a cell:
<script language=JavaScript>
PlaceMenu("mainmenu")
</script>
the problem is when the page loads, the bar is first shown on the exact position as defined in the js file. after a very short time the bar is replaced to the wanted position (in the cell). how can i overcome this disturbing 'flash'? i guess by disabling the exact positioning at the start, but how to do this? or is there another was to position the bar in this cell?
thanks
Poster: kevin3442
Dated: Tuesday April 22 2003 - 1:05:38 BST
The PlaceMenu() function can only bind the menu to a table cell once the table cell has been rendered (i.e., once the body of the document has been processed). Since the menus are among the first things to be displayed, you'll get the flahing problem as the menu jumps from its original location to its table-bound location.
I can suggest two work-arounds.
(1) Toward the top of mmenu.js, there's a variable called loadWait. Normally, loadWait=0. This tells the menus not to wait for the rest of the page. If you change loadWait to 1, the menus should wait until the rest of the page loads to display. You may still get the flash, however... I haven't tried it so I don't know. Also, if you use this approach, you'll have to remember to change that variable each time you download a menu update.
(2) An effective kludge would be to specify a MenuTop and/or MenuLeft position in your main menu array (2nd and 3rd elements respectively), that would initially render the menu off of the visible page. E.g., if you have a horizontal main menu, set its MenuTop location to -200. That way, the menu will be rendered, but it'll be well above the visible page, so the site visitor won't see it until it jumps into the table... no flash from their perspective! This approach also has the advantage that you do not have to edit the mmenu.js file.
Hope that helps,
Kevin