trouble with menualign

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
nethosters
Beginner
Beginner
Posts: 3
Joined: Tue Oct 16, 2007 10:06 pm

trouble with menualign

Post by nethosters »

I'm running out of ideas and wondering if anyone can tell me what I am doing wrong. Here is my test page:

http://www.mitchstuart.com/beta/business/

My client would like to have the three sub menus center aligned below the corresponding suitcase icons. I expected that menualign=center would do it, but it stays left aligned no matter what. I also tried setting left=10, which would have the same effect, but that parameter is being ignored too. It must be something stupid - any suggestions would be appreciated!
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Re: trouble with menualign

Post by John »

First thing that's required is an update to your menu code. You're running v5.719, which is over 2 1/2 years old :!:

Current version (required for help here on the forum) is v5.785.

Let us know when you're up to snuff.
John
nethosters
Beginner
Beginner
Posts: 3
Joined: Tue Oct 16, 2007 10:06 pm

Re: trouble with menualign

Post by nethosters »

Ok John, I've taken your advice and renewed the license for this site, and uploaded the new source files.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: trouble with menualign

Post by Ruth »

Hi,

To start, menualign doesn't do anything with the alignment of the whole menu, it is to align all the items inside the menu, not the text but the actual items. So, let's say you set a horizontal menu of width 800px and you had 10 items but you set their width to 75px, that equals 750. Menualign center would shift those items so that there was equal space on the right and left sides of the menu.

Now, as to what you want. Since this is a horizontal menu the subOffsets do not apply, they are not really needed with horizontals, so to shift the submenu you need to use the properties top="offset="; and left="offset=" in the submenus. Since you have a fixed width parent item which is 10px wider than the sub menu's width you'd set the left="offset=5";

Just some other quick notes to give you information. I notice you have 3 styles for submenus because of the colors. There is an easier way to set those up so you don't have to do all that complete style 3 times. You would do the full menuStyle2 as you have it, then with the others you could do this and you'll see the only coding you did was for the off and on color settings.

Code: Select all

menuStyle3=new copyOf(menuStyle2); 
menuStyle3.onbgcolor="#539BC3";
menuStyle3.oncolor="#000000";
menuStyle3.offbgcolor="#036CA7";
menuStyle3.offcolor="#FFFFFF";

menuStyle4=new copyOf(menuStyle2); 
menuStyle4.onbgcolor="#DA8893";
menuStyle4.oncolor="#000000";
menuStyle4.offbgcolor="#C95160";
menuStyle4.offcolor="#FFFFFF";
Your about submenu would have this and the others of course would just have the style=menuStyle3; or menuStyle4;

Code: Select all

style=menuStyle2;
menuwidth=109;
menualign="center";
left="offset=5";
I added the menuwidth=109; but you could say make that 113 and then with the menualign="center"; in it, the items when you moused over them would show as having 2px space on the left and right of them before the menu's edge. I didn't use top="offset="; but you could also use that to move the menu down or up some pixels from the main menu image bottom edge.

Just a couple more notes, alwaysvisible is not a style propery, it is only a menu property, menualign is also only a menu property as is menuwidth and height. Imageheight and width are style properties and items properties so you could just put the imageheight=110; imagewidth=119; up in the style for that main menu instead of coding it in all the items.

Hope this helps.

Ruth
nethosters
Beginner
Beginner
Posts: 3
Joined: Tue Oct 16, 2007 10:06 pm

Re: trouble with menualign

Post by nethosters »

Ruth, you are a genius. Thanks a million.
Post Reply