ARLO Nester
jQuery contextMenu plugin & polyfill

![Travis Build Status](https://travis-ci.org/medialize/jQuery-contextMenu.svg?branch=master)

$.contextMenu is a management facility for - you guessed it - context menus. It was designed for an application where there are hundreds of elements that may show a context menu - so intialization speed and memory usage are kept fairly small. It also allows to register context menus without providing actual markup, as $.contextMenu generates DOMElements as needed.

features - demo - documentation

Dependencies

Usage

register contextMenu from javascript:

1 $.contextMenu({
2  // define which elements trigger this menu
3  selector: ".with-cool-menu",
4  // define the elements of the menu
5  items: {
6  foo: {name: "Foo", callback: function(key, opt){ alert("Foo!"); }},
7  bar: {name: "Bar", callback: function(key, opt){ alert("Bar!") }}
8  }
9  // there's more, have a look at the demos and docs...
10 });

have a look at the demos.

HTML5 Compatibility

Firefox 8 implemented 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 8 does not yet fully implement the contextmenu specification (Ticket #617528). 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 (Bug #705292).

Note: While the specs note <option>s to be renderd as regular commands, $.contextMenu will render an actual <select>. import contextMenu from HTML5 <menu>:

1 $.contextMenu("html5");

Interaction Principles

You're (obviously) able to use the context menu with your mouse. Once it is opened, you can also use the keyboard to (fully) navigate it.

Besides the obvious, browser also react to alphanumeric key strokes. Hitting r in a context menu will make Firefox (8) reload the page immediately. Chrome selects the option to see infos on the page, Safari selects the option to print the document. Awesome, right? Until trying the same on Windows I did not realize that the browsers were using the access-key for this. I would've preferred typing the first character of something, say "s" for "save" and then iterate through all the commands beginning with s. But that's me - what do I know about UX? Anyways, $.contextMenu now also supports accesskey handling.

Minify

use Google Closure Compiler:

1 // ==ClosureCompiler==
2 // @compilation_level SIMPLE_OPTIMIZATIONS
3 // @output_file_name contextMenu.js
4 // @code_url http://medialize.github.com/jQuery-contextMenu/jquery-1.8.2.min.js
5 // @code_url http://medialize.github.com/jQuery-contextMenu/src/jquery.ui.position.js
6 // @code_url http://medialize.github.com/jQuery-contextMenu/src/jquery.contextMenu.js
7 // ==/ClosureCompiler==

Authors

License

$.contextMenu is published under the MIT license or GPL v3 - which ever suits your needs best.

Changelog

1.6.6 (July 12th 2014)

1.6.5 (January 20th 2013)

1.6.4 (January 19th 2013)

1.6.3 (January 19th 2013)

1.6.2 (January 19th 2013)

1.6.1 (January 19th 2013)

1.6.0 (December 29th 2012)

1.5.25 (October 8th 2012)

1.5.24 (August 30th 2012)

1.5.23 (August 22nd 2012)

1.5.22 (July 16th 2012)

1.5.21 (July 14th 2012)

1.5.20 (June 26th 2012)

Note: git tag of version is v1.6.20?!

1.5.19

Note: git tag of version is missing...?!

1.5.18

Note: git tag of version is missing...?!

1.5.17 (June 4th 2012)

1.5.16 (May 29th 2012)

1.5.15 (May 26th 2012)

1.5.14 (May 22nd 2012)

1.5.13 (May 4th 2012)

1.5.12 (May 2nd 2012)

1.5.11 (April 27th 2012)

1.5.10 (April 21st 2012)

1.5.9 (March 10th 2012)

1.5.8 (January 28th 2012)

1.5.7 (January 21st 2012)

1.5.6 (January 8th 2012)

1.5.5 (January 6th 2012)

1.5.4 (January 5th 2012)

1.5.3 (January 1st 2012)

1.5.2 (December 25th 2012)

1.5.1 (December 18th 2011)

1.5 (December 13th 2011)

1.4.4 (December 12th 2011)

1.4.3 (December 11th 2011)

1.4.2 (December 6th 2011)

1.4.1 (November 9th 2011)

1.4 (November 7th 2011)

1.3 (September 5th 2011)

1.2.2 (August 24th 2011)

1.2.1 (August 24th 2011)

1.2 (August 24th 2011)

1.1 (August 11th 2011)

1.0 (July 7th 2011)