Getting Started
jqxMenu represents a jQuery menu widget that makes it easy to add menus to your
website or web application. With the jqxMenu you can create website menus, customized
context menus, or application-style menu bars with just a small amount of scripting.
Every UI widget from jQWidgets toolkit needs its JavaScript files to be included
in order to work properly.
The first step is to create html page and add links to the javascript files and
css dependencies to your project. The jqxMenu widget requires the following files:
The next step is to create a div element within the body of the html document and
add UL for the menu bar and sub menus and LI elements for each menu item.
The last step is to initialize the widget by adding the following script to the
html document:
To call a function(method), you need to pass the method name and parameters(if any)
in the jqxMenu’s constructor.
$("#jqxmenu").jqxMenu(‘openItem’, itemID);
To set a property(option), you need to pass the property name and value(s) in the
jqxMenu's constructor.
$("#jqxmenu").jqxMenu({ autoOpen: false });
To get a property(option), you need to pass the property name to the jqxMenu's constructor.
var autoopen = $("#jqxmenu").jqxMenu('autoOpen');
To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose
that you want to get the clicked menu item when the user clicks. The example code
below demonstrates how to bind to the ‘itemclick’ event of jqxMenu.
$('#jqxMenu').on('itemclick', function (event) {
var clickedItem = event.args;
});
Basic Vertical Menu Sample
The result of the above code is:
[
フレーム]
Basic Horizontal Menu Sample
The result of the above code is:
[
フレーム]
Basic Context Menu Sample
The result of the above code is:
[
フレーム]