PopMenu Class

Constructor

PopMenu([menu])

An object can be passed to menu parameter to define a list of menu items.

Constants

direction.RIGHT_BOTTOM: integer = 3

since 1.0

direction.RIGHT_TOP: integer = 2

since 1.0

direction.LEFT_BOTTOM: integer = 1

since 1.0

direction.LEFT_TOP: integer = 0

since 1.0

Options

effect: string = fade

since 1.0

fade | slide | none

Transition effects for context menu.

duration: integer = 200

since 1.0

Transition duration in ms if an effect is not 'none'.

contextMenu: boolean = false

since 1.0

A flag determining whether this PopMenu is a top level menu or a sub-menu. Please use contextMenu() to change this value.

Properties

$: jQuery

since 1.0

Reference to DOM (jQuery) representation of the context menu.

id: string = (random)

since 1.0

The HTML ID of the PopMenu.

data: Object

since 1.0

Internally stores the menu options. Please use options() method to get/set menu options.

Methods

append: PopMenuItem

since 1.0

append(id, options)

Append a menu item at the end of the list.

contextMenu: boolean

since 1.0

contextMenu(value)

Set the PopMenu as a top level context menu if true is passed as the value. Or get the current status if no parameter is passed.

find: PopMenuItem

since 1.0

find(id)

Find a menu item. If a particular item is not found, NULL will be returned.

hide: void

since 1.0

hide([effect [, duration]])

Hide context menu if currently being shown.

hideSubmenus: void

since 1.0

hideSubmenus([effect [, duration]])

Hide submenus if currently being shown.

insert: PopMenuItem

since 1.0

insert(id, options, after)

Insert a menu item in the middle of the list.

options: object

since 1.0

options([options])

Get/set menu options.

populateMenu: void

since 1.0

populateMenu(menu)

Populate PopMenu with menu items. Existing items will be kept.

prepend: PopMenuItem

since 1.0

prepend(id, options)

Insert a menu item at the beginning of the list.

remove: void

since 1.0

remove(id)

Remove a menu item and its submenus.

selectedItem: PopMenuItem

since 1.0

selectedItem()

Get currently selected item. If no item is selected, null will be returned.

show: void

since 1.0

show(x, y, [effect [, duration]])

Show context menu. If x and y coordinates are speified, the context menu expand direction will be automatically determined not to overflow the viewport. By default, the expand direction is to bottom right. Please note that this function only works for context menu. For submenu, use showAsSubmenu() instead.

showAsSubmenu: void

since 1.0

showAsSubmenu([direction, [effect [, duration]]])

Show sub-menu. By default, the expand direction is to bottom right. Please note that this function only works for submenu. For context menu, use show() instead.

updateLabels: void

since 1.0

updateLabels([force])

Update all menu labels.