Bit by bit we got it!
Thanks for your help.
Here is the code -- some minor alterations regarding the frame. I removed some specific-use code I had in there.
//distantMenu - opens up milonic menuName inside of mainmenu_body
function distantMenu( menuName )
{
parent.frames['mainmenu_body'].popdown();
strItemPos = gpos(gmobj("el"+_itemRef));
parent.frames['mainmenu_body'].spos(parent.frames['mainmenu_body'].gmobj("menu" + parent.frames['mainmenu_body'].getMenuByName(menuName)),null,strItemPos[1],null,null);
parent.frames['mainmenu_body'].popup(menuName);
}
pulling the X coordinate for each item in a horizontal menu
Hmmm... yep, I forgot that the menu objeject had to be gotten from the content frame; glad to see you got it.
It occurs to me that it would probably be more efficient to change the distantMenu() function in the nav frame so that all it does is get the x coordinate and pass it and the menuName to a function in the content frame that would set the position and open the menu. In other words, like this:
In menu_data.js in the nav frame:
In menu_data.js in the content frame:
This would require fewer references of the content frame from the nav frame (1 instead of 5). Anyway, just a thought...
Have you tried this in various browsers? I was wondering if you might end up having to do a little sniffing and apply a browser-specific offset to the x coordinate?
Kevin
It occurs to me that it would probably be more efficient to change the distantMenu() function in the nav frame so that all it does is get the x coordinate and pass it and the menuName to a function in the content frame that would set the position and open the menu. In other words, like this:
In menu_data.js in the nav frame:
Code: Select all
function distantMenu(menuName)
{
strItemPos = gpos(gmobj("el"+_itemRef));
parent.frames['mainmenu_body'].openSubmenu(menuName, strItemPos[1]);
}
Code: Select all
function openSubmenu(menuName, left)
{
popdown();
spos(gmobj("menu" + getMenuByName(menuName)),null,left,null,null);
popup(menuName);
}
Have you tried this in various browsers? I was wondering if you might end up having to do a little sniffing and apply a browser-specific offset to the x coordinate?
Kevin
I've been following this and trying to figure out how to use it to set the submenus so that they will center with regard to the item from which they drop. I think that what you are doing here would allow me to do that, but it's kind of given in pieces on how to do each thing and I can't figure out how you would put it together to 1st find the location of the menu item, then tell the submenu that opens from it to center from that menu item's references as to location and width. Is it possible using what is here, and how would i put them together into one function.
Ruth
Ruth
Not frames. I've always wanted to be able to position the middle submenus so they are centered from their parent item. I'm pretty sure that wouldn't be a good idea for the first and last item of the main menu because I use screen position center and you never know the visitor's browser window size, so centering those items might have part of them hidden off the screen.
Ruth
Ruth
-
- Beginner
- Posts: 1
- Joined: Wed Jan 04, 2006 7:52 pm
- Location: Chilhowie, VA
- Contact:
Hi, I made a pop-up menu in Dreamweaver and need to reposition the child-menus and I am unsure if this code can apply to the javascript associated with that menu or if there is a more specific way to do it in that menu. You can look at just the menu at: http://newchillsdesign.chillsnet.org/test/menu.htmlAndy wrote:Here are some internals that might be of use.
getMenuByName("menuname")
Will return the reference number for a menu.
gmobj("objname")
Will return a reference to an object, for example:
Will set myMenu variable as the mainmenus object. You can then use this to get and set properties.Code: Select all
myMenu = gmobj("menu"+getMenuByName("mainmenu"))
To get the dimensions of a menu, use:
This creates an array with the menu dimensions and positioning, like this:Code: Select all
myMenu = gmobj("menu"+getMenuByName("mainmenu")) menuDimensions=gpos(myMenu)
menuDimensions[0] // Top
menuDimensions[1] // Left
menuDimensions[2] // Height
menuDimensions[3] // Width
To set the position of a menu, use spos(), like this:
syntax: spos(myMenu,top,left,height,width)Code: Select all
myMenu = gmobj("menu"+getMenuByName("mainmenu")) spos(myMenu,10,10,200,200)
The above aren't just for menus, they can be used for any HTML object.
Hope this helps
Andy
This menu is incorperated already in the main site, but I really need the "Public Services" child menus repositioned. I have read so many tutorials asked many people over the past couple weeks and cannot figure it out. I can read the "javascript" make-up of the menu and understand the basic make up, but I don't understand commands or things like that. Thanks for any help you can give.
Mike C. Nichols
Hi Mike,
Unfortunately, you've found the wrong site. The Milonic website and these forums are for the Milonic DHTML Menu. I had a quick look at your code, and you're using an entirely different menu system: mm_menu, from MacroMedia. From looking at the js code, it seems that system may have last been updated in 2002, and dates back to 1997. Milonic Menus can do what you want. If you'd care to try them out, you'll find plenty of on-line and downloadable samples from the main site, http://milonic.com
Good luck,
Kevin
Unfortunately, you've found the wrong site. The Milonic website and these forums are for the Milonic DHTML Menu. I had a quick look at your code, and you're using an entirely different menu system: mm_menu, from MacroMedia. From looking at the js code, it seems that system may have last been updated in 2002, and dates back to 1997. Milonic Menus can do what you want. If you'd care to try them out, you'll find plenty of on-line and downloadable samples from the main site, http://milonic.com
Good luck,
Kevin