Module: DropdownMenu

Creates a drop down menu in your javaScript code.
Author:
License:
  • under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Source:

Methods

(inner) create(arrayMenu, optionsopt)

Creates new menu
Parameters:
Name Type Attributes Description
arrayMenu Array array of menu and submenu items. If array item is string then menu item name. If array item is object then options of the new menu item:
Properties
Name Type Attributes Description
name String | HTMLElement <optional>
if string then menu item name. If HTMLElement then item element.
title String <optional>
menu item title.
id String <optional>
menu item identifier.
style String <optional>
menu item style. Example: "float: right;".
items Array <optional>
array of submenu items. Same as menu item.
onclick function <optional>
function(event) called when user has clicked a menu item. event - event details.
drop Object <optional>
direction of drop of the submenu.
Following directions is available:
If string then "up" - drop submenu to up. "left" - shift submenu to left.
If object then following members is available:
Properties
Name Type Attributes Description
up boolean <optional>
true - drop submenu to up.
left boolean <optional>
true - shift submenu to left.
radio boolean <optional>
true - defines a radio menu item.
checkbox boolean <optional>
true - defines a checkbox menu item.
checked boolean <optional>
true - checked state of a checkbox or radio menu item.
options Object <optional>
the following options are available.
Properties
Name Type Attributes Default Description
elParent HTMLElement <optional>
"body" element Parent element of new menu.
canvas HTMLElement <optional>
canvas element. Use if you want put a menu inside a canvas. Use CanvasMenu instead DropdownMenu for it.
decorations String <optional>
You can decorate your menu by a built-in style or use your custom style. Currently two built-in styles is available:
'Gradient' - use gradient.css file for decoration.
'Transparent' - use transparent.css file for decoration.
Custom decoration:
'Custom' please edit the custom.css file from my example if you want a custom decoration of your menu.
Source: