Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:52

Varying _subOffsetLeft for multiple sub levels


Poster: JayZee
Dated: Monday February 28 2005 - 4:29:14 GMT

The main menu is vertical, with two sub menu levels. Is it possible to create a different left offset value for each sub level? Thank you.


Poster: kevin3442
Dated: Monday February 28 2005 - 5:16:53 GMT

Hi JayZee,

It's not possible using _subOffsetLeft, because that's a global variable. However, you could do it like this:

(1) Define another global variable at the top of menu_data.js, like:
Code:
subLeftOffset=10;

Set the value (e.g., 10 above) to however many pixels you want to use for the additional offset. You can use a negative value to offset the position to the left, or a positive value to offset to the right.

(2) For any submenu where you want to apply the additional offset, put the following code in the menu definition:
Code:
left="offset="+subLeftOffset;

So, the menu definition would look something like this:
Code:
with(milonic=new menuname("Menu Name")){
style=menuStyle;
left="offset="+subLeftOffset;
aI("text=Item Text;url=theurl.htm;");
...
}

The reason you'd use a variable, rather than just putting left="offset=10"; in each affected menu definition is that using a variable makes it easier to change later. For example, suppose you edited 15 submenus, then decided that 10 wasn't the right value. Rather than re-editing all 15 submenus, you'd just change the value assigned to subLeftOffset at the top, which would adjust all of the submenus using that variable.

A couple of last notes: (1) If you don't use subLeftOffset in a submenu, it will still use the default _subOffsetLeft value. (2) The offset applied by the new subLeftOffset variable is in addition to the offset provided by _subOffsetLeft; they are cumulative.

Hope that helps,

Kevin


Poster: JayZee
Dated: Monday February 28 2005 - 11:41:53 GMT

Kevin,
Thanks for the solution. It works great! Just for good measure I applied the same approach to the top offset with equally good results. It is very helpful to have an adjustment like this in the Milonic toolkit.

Your description and walkthrough were thorough, and it all made sense to a novice like me.

This forum is what convinced me to buy a license. Milonic has a very active support team, and I appreciate your rapid assistance.

JayZee