Class: Menu

Menu()

This class contains static methods for managing menus. It is not meant to be constructed.

Only one menu can be open at a time.

Constructor

Source:

Methods

(static) closeMenu()

Closes a menu.

Source:

(static) createMenu(name_prefix, x, y, options)

Creates and displays a menu.

If you want to refer to the menu block in CSS, use .<name_prefix>_menu.

Parameters:
Name Type Description
name_prefix String

Prefix to use for the menu block class in CSS.

x int

x-part of the upper-left corner position of a menu.

y int

y-part of the upper-left corner position of a menu.

options Array

Array of menu items of type [k, v], where k is the label of a menu item to be displayed and v is of form [<arbitrary data>, <click event handler>]. Click event handlers must accept event (corresponding to a JavaScript click event object) as the first argument. <arbitrary data> will be accessible in a click handler through event.data.data.

Source:

(static) createMenuWithCustomBlocks(name_prefix, x, y, blocks)

Creates and displays a menu with custom-made blocks.

If you want to refer to the menu block in CSS, use .<name_prefix>_menu.

Parameters:
Name Type Description
name_prefix String

Prefix to use for the menu block class in CSS.

x int

x-part of the upper-left corner position of a menu.

y int

y-part of the upper-left corner position of a menu.

blocks Array

Array of custom menu items of type {item: <item>, hover: <hover>, click_handler: [<arbitrary data>, <click event handler>]}, where <item> is a jQuery object representing a custom menu item element (e.g. $('<div>Hello World!</div>')), <hover> is a boolean indicating whether the item should be highlighted on hover, and [<arbitrary data>, <click event handler>] is the same as in createMenu(). <hover> is optional, its default value is false.

Source: