submenu positioning

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
drumbo
Advanced
Advanced
Posts: 20
Joined: Tue Dec 06, 2005 7:09 pm

submenu positioning

Post by drumbo »

Hi,

I have a 3 level menu. The 1st level is always visible (the main menu), the second and third both "pop up" when "moused over". I have used the _suboffsetlleft so that I can position the second submenu in the right place (25px to the right).
The problem is then that the 3rd submenu is also offset by the _suboffsetleft value. Is there anyway to make it that only the second submenu uses the _suboffsetleft value?

Thanks
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Set _subOffsetLeft=0; and instead, apply a horizontal offset to each second-level menu individually using the left property in the menu definition, like so:

Code: Select all

with(milonic=new menuname("Products")){
style=subStyle;
left="offset=25";
...
aI("...");
}
Since the offset values is defined in a string, you could also use a global string variable, in case you want to tweak it without having to edit every menu definition each time. Like so:

Code: Select all

// Globals

_SubOffsetLeft = 0;
...
leftSubOffset = "offset=25";

...

// Menu defs

with(milonic=new menuname("Products")){
style=subStyle;
left=leftSubOffset;
...
aI("...");
Now, if you wanted to change the second-level offset to, say, 30 you would just edit the value assigned to leftSubOffset; e.g.,

Code: Select all

leftSubOffset="offset=30";
Hope that helps,

Kevin
drumbo
Advanced
Advanced
Posts: 20
Joined: Tue Dec 06, 2005 7:09 pm

Post by drumbo »

Hi Kevin,

Thanks for the answer. Unfortunately I don't seem to be able to get it to work.

These are my two styles (the rawcss in the 1st one is to get the padding to the right but I can't have an image now other wise the image is padded to the end and therefore does not sit where I want it)

with(HeadersStyle=new mm_style()){
offbgcolor = "transparent"
onbgcolor="#FFFFFF"
outfilter="randomdissolve(duration=0.5)";
overfilter="Fade(duration=0.2);Alpha(opacity=80);)";
padding=1;
imagepadding=0;
pagebgcolor="#FFFFFF";
pagecolor="black";
separatorsize=0;
subimagepadding=1;
if(ie){
rawcss="padding-right:12px;";
}
else{
rawcss="padding-left:10px;padding-right:35px;";
}
}

with(SubMenuStyle=new mm_style()){
left="offset=25";
offbgcolor = "#FFFFFF"
onbgcolor="#EC9B13"
outfilter="randomdissolve(duration=0.5)";
overfilter="Fade(duration=0.2);Alpha(opacity=90);)";
padding=1;
pagebgcolor="#EC9B13";
pagecolor="black";
separatorsize=0;
subimage="/images/arrow.gif";
rawcss="padding-right:5px;";
}
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi,

You've put left="offset=25"; in a menu style definition. It's a menu property, rather than a style property. You have to use it in the menu definition, rather than a menu style definition (e.g., as in the "Products" menu in the example I posted earlier). That may do the trick.

Hope that helps,

Kevin
drumbo
Advanced
Advanced
Posts: 20
Joined: Tue Dec 06, 2005 7:09 pm

Post by drumbo »

Doh, that was careless - sorry about that - will give it a try
Post Reply