Menu dynamic horizontal positioning

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
kev_hilton@hotmail.com
Beginner
Beginner
Posts: 2
Joined: Sun May 19, 2002 7:24 pm

Menu dynamic horizontal positioning

Post by kev_hilton@hotmail.com » Sat May 18, 2002 10:15 pm

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????

kev_hilton@hotmail.com
Beginner
Beginner
Posts: 2
Joined: Sun May 19, 2002 7:24 pm

Re: Menu dynamic horizontal positioning

Post by kev_hilton@hotmail.com » Sun May 19, 2002 10:50 am

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.

Post Reply