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 ._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 `[, ]`. Click event handlers must accept `event` (corresponding to a JavaScript click event object) as the first argument. `` 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 ._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: , hover: , click_handler: [, ]}`, where `` is a jQuery object representing a custom menu item element (e.g. `$('
Hello World!
')`), `` is a boolean indicating whether the item should be highlighted on hover, and `[, ]` is the same as in `createMenu()`. `` is optional, its default value is false.
Source: