features - demo - documentation
- jQuery 1.6 (not tested with older versions)
- jQuery UI position (optional but recommended)
The Firefox nightlies implement contextmenu using the 'menuitem' tags for menu-structure. The specs however state that 'command' tags should be used for this purpose. $.contextMenu accepts both.
Firefox 9.0a1 does not yet fully implement the contextmenu specification. The elements a, button, input and option usable as commands are being ignored altogether. It also doesn't (optically) distinguish between checkbox/radio and regular commands. See Screenshot.
Note: While the specs note <option>s to be renderd as regular commands, $.contextMenu will render an actual <select>.
register contextMenu from javascript:
$.contextMenu({
// define which elements trigger this menu
selector: ".with-cool-menu",
// define the elements of the menu
items: {
foo: {name: "Foo", callback: function(key, opt){ alert("Foo!"); }},
bar: {name: "Bar", callback: function(key, opt){ alert("Bar!") }}
}
// there's more, have a look at the demos and docs...
});import contextMenu from HTML5 <menu>:
$.contextMenu("html5");
// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// @output_file_name contextMenu.js
// @code_url http://medialize.github.com/jQuery-contextMenu/jquery-1.6.2.min.js
// @code_url http://medialize.github.com/jQuery-contextMenu/jquery.ui.position.js
// @code_url http://medialize.github.com/jQuery-contextMenu/jquery.contextMenu.js
// ==/ClosureCompiler==
- Rodney Rehm
- Christiaan Baartse (single callback per menu)
- Addy Osmani (compatibility with native context menu in Firefox 8)
$.contextMenu is published under the MIT license.