JavaScript Menu, DHTML Menu Powered By Milonic
Demo - mm_changeMenuProperty Function
for use with Milonic Solutions' DHTML Menu V5
This sample page was created in reference to this thread of discussion in the "Help and Support Version 5".

The application of the function in this sample coverts the menu from horizontal to vertical on click.

The function.

This function applies to the properties of menus, i.e. orientation, visibility, followscroll, keepalive, screenposition, etc.  

function mm_changeMenuProperty(menuName, propertyRef, newValue) 
{ 
  var menuNum = getMenuByName(menuName); 
  _m[menuNum][propertyRef] = newValue; 
  BDMenu(menuNum); 
}

The Parameters

The function takes three (3) parameters, menuName, propertyRef, newValue

  1. menuName  is the name of the menu to which you want to apply the property change [name you give the menu i.e. Main etc.] It is not case sensitive.
  2. propertyRef  the numbered reference to the property you want to change i.e. orientation is numbered 9. These code references can be found in the the menu properties reference.
  3. newValue  is the new value that you want to assign to the identified menu and menu property. This might be a numeric or a string value, depending on what type of property you are changing (orientation or text align would be a string, widths would be numeric).

Demos

The demo on this page uses the mm_changeMenuProperty() function in conjunction with toggleMainOrientaton() function and a conditional if/else statement to achieve the change.

var mainIsVertical = false;

function mm_changeMenuProperty(menuName, propertyNumber, newValue)
{
  var menuNum = getMenuByName(menuName);
  _m[menuNum][propertyNumber] = newValue;
//  BDMenu(menuNum);
}
function toggleMainOrientation()
{
  var menuNum = getMenuByName("mainmenu");

  mainIsVertical = !mainIsVertical;

  if (mainIsVertical) {
    mm_changeMenuProperty("mainmenu", 9, "vertical");
    }
  else {
    mm_changeMenuProperty("mainmenu", 9, "horizontal");
  }

  BDMenu(menuNum);
}

The other demos use only the mm_changeMenuProperty function coded directly on the pages within script tags. Coding the function on the page allows for the application of a particular property on specified pages.

DHTML Menu courtesy of Milonic Solutions

Download Toggle Menu Orientation sample