Search
MenuItem Constructor
See Also
 






Initializes a new instance of the MenuItem class.

Namespace: MindFusion.Common.UI
File: MenuItem.js

 Syntax

JavaScript  Copy Code

function MenuItem ([title, [href]])

 Parameters

title
Optional.

String. The display text of this item.

href
Optional.

String. The URL this item is pointing to.

 Example

The following example creates a Menu and adds a MenuItem to it:

JavaScript  Copy Code

// Create a new Menu control.
var menu = new ui.Menu();
// Apply the custom css theme.
menu.theme = "custom";
menu.width = new ui.Unit(200, ui.UnitType.Pixel);
menu.left = new ui.Unit(20, ui.UnitType.Pixel);
menu.itemSize = new ui.Unit(40, ui.UnitType.Pixel);

// Create a new MenuItem, displaying a link.
var item = new ui.MenuItem("Home");
item.imageSrc = "icon_home.png";
item.href = "http://www.mindfusion.eu";
menu.items.add(item);

// Draw and attach the menu control.
document.body.appendChild(menu.draw());
menu.attach();

 See Also