Varying _subOffsetLeft for multiple sub levels
Varying _subOffsetLeft for multiple sub levels
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.
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:
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:
So, the menu definition would look something like this:
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
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: Select all
subLeftOffset=10;
(2) For any submenu where you want to apply the additional offset, put the following code in the menu definition:
Code: Select all
left="offset="+subLeftOffset;
Code: Select all
with(milonic=new menuname("Menu Name")){
style=menuStyle;
left="offset="+subLeftOffset;
aI("text=Item Text;url=theurl.htm;");
...
}
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
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
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