Positioning of submenu *SOLVED*

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
slomo
Beginner
Beginner
Posts: 4
Joined: Fri Feb 09, 2007 5:22 am

Positioning of submenu *SOLVED*

Post by slomo »

Hi,

I'm stuck..
My menu has 3 levels..
I wanted to center the 2nd level menu under its 1st level. I am not sure how to explain this. Please see the attached image for a clearer explanation.

Image

mouseover [Menu] will shows me list of 2nd levels. I want those [L2 Menu x] to be centered under [Menu]..

How can I do this? Thanks!

All menu are in image, not text[/img]
Last edited by slomo on Mon Apr 09, 2007 8:57 am, edited 1 time in total.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

If you are using images for the menu items, then you should be able to use offsets to 'center' the submenu. So, let's say the image for the word Menu is 40px wide, and the images for the L2 Menu 1 is 100px wide, normally the left side of the submenu will open even with the left side of the main parent item, so using a left="offset=-30"; should shift that menu back toward the left by 30px thereby 'centering' it. Using images allows this to be done pretty easily, it's only with text you can't really use that since users' browser text size might be bigger or smaller.

Hope this helps.

Ruth
slomo
Beginner
Beginner
Posts: 4
Joined: Fri Feb 09, 2007 5:22 am

Post by slomo »

sorry.. I don't quite get what you said. ;-p
_menuCloseDelay=100;
_menuOpenDelay=100;
_subOffsetTop=0;
_subOffsetLeft=2;

with(AllImagesStyle=new mm_style()){
styleid=1;
bordercolor="#000000";
borderstyle="solid";
fontstyle="normal";
fontweight="normal";
padding=3;
}

with(menuStyle=new mm_style()){
bordercolor="#f6d9b0";
borderstyle="solid";
borderwidth=0;
fontfamily="Arial, Helvetica, sans-serif";
fontsize="75%";
fontstyle="normal";
headerbgcolor="#ffffff";
headercolor="#000000";
offbgcolor="#ffffff";
offcolor="#515151";
onbgcolor="#ffffff";
oncolor="#ffffff";
outfilter="Fade(duration=0.2);Alpha(opacity=100);Direction=135, Strength=5)";
overfilter="Fade(duration=0.2);Alpha(opacity=100);Direction=135, Strength=5)";
padding=0;
pagebgcolor="#82B6D7";
pagecolor="black";
separatorcolor="#2D729D";
separatorsize=0;
subimagepadding=0;
}

with(milonic=new menuname("Main")){
alwaysvisible=1;
orientation="horizontal";
style=AllImagesStyle;
position="relative";
aI("image=images/navi_menu/0_1_0.jpg;overimage=images/navi_menu/0_1_1.jpg;url=#;");
aI("image=images/navi_menu/0_2_0.jpg;overimage=images/navi_menu/0_2_1.jpg;url=#;");
aI("image=images/navi_menu/0_3_0.jpg;overimage=images/navi_menu/0_3_1.jpg;url=#;showmenu=L2 Menu;");
aI("image=images/navi_menu/0_4_1.jpg;overimage=images/navi_menu/0_4_1.jpg;url=#;");
aI("image=images/navi_menu/0_5_0.jpg;overimage=images/navi_menu/0_5_1.jpg;url=#;");
aI("image=images/navi_menu/0_6_0.jpg;overimage=images/navi_menu/0_6_1.jpg;url=#;");
aI("image=images/navi_menu/0_7_0.jpg;overimage=images/navi_menu/0_7_1.jpg;url=#;");
aI("image=images/navi_menu/0_8_0.jpg;overimage=images/navi_menu/0_8_1.jpg;url=#;");
}

with(milonic=new menuname("L2 Menu")){
overflow="scroll";
style=menuStyle;
aI("image=images/navi_menu/1_1_0.jpg;overimage=images/navi_menu/1_1_1.jpg;showmenu=subBM;");
aI("image=images/navi_menu/1_2_0.jpg;overimage=images/navi_menu/1_2_1.jpg;showmenu=subSyd;");
aI("image=images/navi_menu/1_3_0.jpg;overimage=images/navi_menu/1_3_1.jpg;showmenu=subKun;");
aI("image=images/navi_menu/1_4_0.jpg;overimage=images/navi_menu/1_4_1.jpg;showmenu=subPen;");
aI("image=images/navi_menu/1_5_0.jpg;overimage=images/navi_menu/1_5_1.jpg;showmenu=subKul;");
aI("image=images/navi_menu/1_6_0.jpg;overimage=images/navi_menu/1_6_1.jpg;showmenu=subPul;");
}

drawMenus();
The above is the menu_data.js for my menu. Where should I apply that left="offset=-30";?

thanks!

EDIT:
i tried to insert left="subset=-xx"; ..
with(milonic=new menuname("L2 Menu")){
overflow="scroll";
style=menuStyle;
left="subset=-xx";
aI......
my 2nd level menu became slightly centered of Menu 3 instead..
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

Well, I can't give you figures since I don't have your menu, i.e., the page with the menu and the images to be able to figure out the correct offset numbers.

One thing, I notice you have the main menu inside the menu data file and you have it set to be position='relative'; please read the information about positioning relative menus from the links found here

viewtopic.php?t=8777

The beginners' example page is here:

http://support.milonic.com/beginners/ta ... /index.htm

As to where you put the offset, you put it in the submenu which is being opened. For example, if it has to be shifted back to the left by 30px you would code it as:

Code: Select all

with(milonic=new menuname("L2 Menu")){ 
left="offset=-30";
overflow="scroll"; 
style=menuStyle; 
Ruth
slomo
Beginner
Beginner
Posts: 4
Joined: Fri Feb 09, 2007 5:22 am

Post by slomo »

thanks ruth!
i'll have a try

EDIT:
Done! and it's centered!
Actually I've made a mistake there.. I put subset=-xx instead of offset=-xx :P :lol:
Post Reply