Skip to content

Commit 8a77b2b

Browse files
committed
Add the callback to a few of the docs, and the API docs
1 parent af453fa commit 8a77b2b

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
### Unreleased
44

5+
#### Changed
6+
7+
* Callback function now supplies original event ([Issue #211](https://github.com/swisnl/jQuery-contextMenu/issues/211)) thanks @wizzard0
8+
59
### 2.4.5
610

711
#### Fixed

documentation/demo/callback.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ currentMenu: callback
2020
$(function(){
2121
$.contextMenu({
2222
selector: '.context-menu-one',
23-
callback: function(key, options) {
23+
callback: function(itemKey, opt, rootMenu, originalEvent) {
2424
var m = "global: " + key;
2525
window.console && console.log(m) || alert(m);
2626
},
@@ -29,7 +29,7 @@ $(function(){
2929
name: "Edit",
3030
icon: "edit",
3131
// superseeds "global" callback
32-
callback: function(key, options) {
32+
callback: function(itemKey, opt, rootMenu, originalEvent) {
3333
var m = "edit was clicked";
3434
window.console && console.log(m) || alert(m);
3535
}

documentation/demo/custom-command.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ $(function(){
5252
**************************************************/
5353
$.contextMenu({
5454
selector: '.context-menu-one',
55-
callback: function(key, options) {
55+
callback: function(itemKey, opt, rootMenu, originalEvent) {
5656
var m = "clicked: " + key;
5757
window.console && console.log(m) || alert(m);
5858
},

documentation/docs/items.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ The Callback is executed in the context of the triggering object. The first argu
9393

9494
If no callback and no default callback is specified, the item will not have an action
9595

96-
`callback`: `function(itemKey, opt)`
96+
`callback`: `function(itemKey, opt, rootMenu, originalEvent)`
9797

9898
#### Example
9999

100100
```javascript
101101
var items = {
102102
firstCommand: {
103103
name: "Copy",
104-
callback: function(itemKey, opt){
104+
callback: function(itemKey, opt, rootMenu, originalEvent){
105105
// Alert the key of the item and the trigger element's id.
106106
alert("Clicked on " + itemKey + " on element " + opt.$trigger.id);
107107

0 commit comments

Comments
 (0)