Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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: Thursday February 8 2018 - 06:02:42

Menu dynamic horizontal positioning


Poster: kev_hilton __at__ hotmail.com
Dated: Saturday May 18 2002 - 22:15:59 BST

Im interested in dynamically adjusting the width of the menu to span the width of the browser page. I can detect the width of the browser window with the following

function setwinwidth(){
if (window.innerWidth == null) {iw = document.body.clientWidth;}
else { iw = window.innerWidth;}
return iw;
}
//This works with both netscape and IE

I understand how to set the menu width under the addmenu function. I believe it is the 4th option in the list
(Here is the snippet):
addmenu(menu=[ //
"main_top_menu", // Menu Name -
-50, // Menu Top -
-50, // Menu Left -
, // Menu Width -
etc.....

Id like to make the width of the menu exactly the width of the window. I thought I add add the function to the .js file where the menus are defined, and then call the function setwinwidth() from the Menu Width line using eval(setwinwidth). Heres the example:

addmenu(menu=[ //
"main_top_menu", // Menu Name -
-50, // Menu Top -
-50, // Menu Left -
eval(setwinwidth()), // Menu Width -
etc.....

This method however does not work.

Any suggestions????

Re: Menu dynamic horizontal positioning


Poster: kev_hilton __at__ hotmail.com
Dated: Sunday May 19 2002 - 10:50:23 BST

Am I able to call spos from the main html file after first calling the PlaceMenu function? Also when calling spos I would like to invoke the following:

->>As written
spos(gm,t_,l_,h_,w_)

Does gm refer to the object????? If gm represents an object I would like to use the following call:

spos(gmobj(mtxt),t_,l_,h_,w_)

Does mtxt refer to the ID number or the name of the menu??? Ive tried both however neither seems to work.

As stated in the previous post I would like to center the menu in the window by seting the left parameter by first calculating the width of the browser window, using the getMenuItem function to dynamically discover the width of the menu, the setting the left offset parameter using the spos function.
It would be possible also to center the menu at all times with other javascript methods to dynamically position the menu on page reload and page reposition.

Thanks for any input anyone may have. I find it very difficult to use code other people have written.