z-index of menu layers

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
potsk
Beginner
Beginner
Posts: 1
Joined: Fri Oct 06, 2006 7:28 am

z-index of menu layers

Post by potsk »

hi!

i have dragable divs in my site, when they are clicked they are moved to foreground, then the menu is always in the background. is there a possibility to move the menu in foreground on mouseover?

thx in advance
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,

I believe the menus have a zindex of 999 by default, just so you know the starting point.

Each menu has a menu property called zindex (codeRef = 27). You could set that programatically for any particular menu, using the following function:

Code: Select all

function mm_changeMenuProperty(menuName, propertyRef, newValue, updateDisplay)
{
  var menuNum = getMenuByName(menuName);
  _m[menuNum][propertyRef] = newValue;
  if (updateDisplay) BDMenu(_mi[i][0]);
}
For example:

Code: Select all

mm_changeMenuProperty('Products', 27, 1000);
would change the zindex of the "Products" menu to 1000. You could call this code from any menu item's onfunction property.

Alternatively, you could use a function to set the zindex for all menus by looping through the _m[] array and setting _m[27] to the desire zindex. Like so:

Code: Select all

function mm_setGlobalZindex(zi)
{
  for (var i=0; i<_m.length; i++) _m[i][27] = zi;
}
So

Code: Select all

mm_setGlobalZindex(1001);
would set the zindex for all menus to 1001.

Just a s asuggestion, since the draggable div's must include call code to set it's own zindex higher than other objects, it might be easier to call a function with the div's onmouseout to set the div's zindex back to its starting point.

Hope that helps,

Kevin
Post Reply