Skip to content

Commit 4b8e9cf

Browse files
committed
Add tooltip option
Close mar10#92
1 parent 8d1f5d1 commit 4b8e9cf

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# 1.9.1-0 / Unreleased
22

3+
* [FEATURE] New option `tooltip`, adds a `title` attribute to the menu markup
4+
35
# 1.9.0 / 2015-04-20
6+
47
* [FEATURE] New option `autoFocus`, defaults to *false*
58
* [BUGFIX] #82 Fixed AMD dependencies
69

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ $(document).contextmenu({
324324
which is especially useful for touch devices (but may require external
325325
plugins to generate <code>taphold</code> events).
326326
</dd>
327+
<dt>tooltip</dt>
328+
<dd>
329+
Type: <code>String</code>, optional<br>
330+
Add a <code>title</code> attribute to the menu markup, which will be displayed
331+
as tooltip by most browser (or external plugins).
332+
</dd>
327333
<dt>uiMenuOptions</dt>
328334
<dd>
329335
Type: <code>Object</code>, default: <code>{}</code><br>

demo/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
{title: "----"},
8989
{title: "More", children: [
9090
{title: "Sub 1 (callback)", action: function(event, ui) { alert("action callback sub1");} },
91-
{title: "Edit <kbd>[F2]</kbd>", cmd: "sub2"},
91+
{title: "Edit <kbd>[F2]</kbd>", cmd: "sub2", tooltip: "Edit the title"},
9292
]}
9393
],
9494
// Handle menu selection to implement a fake-clipboard

jquery.ui-contextmenu.js

+3
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ $.extend($.moogle.contextmenu, {
419419
if ( $.isPlainObject(entry.data) ) {
420420
$parentLi.data(entry.data);
421421
}
422+
if ( entry.tooltip != null ) {
423+
$parentLi.attr("title", entry.tooltip);
424+
}
422425
}
423426
},
424427
/** Convert a nested array of command objects into a <ul> structure. */

0 commit comments

Comments
 (0)