|
19 | 19 | options: {
|
20 | 20 | delegate: "[data-menu]", // selector
|
21 | 21 | menu: null, // selector or jQuery or a function returning such
|
22 |
| - preventBuiltinMenu: true, |
| 22 | +// preventBuiltinMenu: true, |
23 | 23 | // Events:
|
24 | 24 | beforeopen: $.noop, // menu about to open; return `false` to prevent opening
|
25 | 25 | blur: $.noop, // menu option lost focus
|
|
31 | 31 | select: $.noop // menu option was selected; return `false` to prevent closing
|
32 | 32 | },
|
33 | 33 | _create: function () {
|
34 |
| - this.element.delegate(this.options.delegate, "click", $.proxy(this._openMenu, this)); |
35 |
| - if(this.options.preventBuiltinMenu){ |
36 |
| - this.element.delegate(this.options.delegate, "contextmenu.contextmenu", function(event){ |
37 |
| - return false; |
38 |
| - }); |
39 |
| - } |
| 34 | + this.element.delegate(this.options.delegate, "contextmenu.contextmenu", $.proxy(this._openMenu, this)); |
| 35 | +// if(this.options.preventBuiltinMenu){ |
| 36 | +// this.element.delegate(this.options.delegate, "contextmenu.contextmenu", function(event){ |
| 37 | +// return false; |
| 38 | +// }); |
| 39 | +// } |
40 | 40 | this._trigger("init");
|
41 | 41 | },
|
42 | 42 | /** Return menu jQuery object. */
|
43 | 43 | _getMenu: function(){
|
44 |
| - // this.options.menu may be a string, jQuery or a function returnig that. |
| 44 | + // this.options.menu may be a string, jQuery or a function returning that. |
45 | 45 | var $menu = this.options.menu;
|
46 | 46 | if( $.isFunction($menu) ){
|
47 | 47 | $menu = $menu();
|
|
55 | 55 | },
|
56 | 56 | /** Open dropdown. */
|
57 | 57 | _openMenu: function(event){
|
| 58 | + event.preventDefault(); |
58 | 59 | if( this._trigger("beforeopen", event) === false ){
|
59 | 60 | return false;
|
60 | 61 | }
|
|
88 | 89 | });
|
89 | 90 | $menu
|
90 | 91 | .css({
|
91 |
| - position: "absolute" |
| 92 | + position: "absolute", |
| 93 | + left: 0, |
| 94 | + top: 0 |
92 | 95 | }).position({
|
93 | 96 | my: "left top",
|
94 | 97 | at: "left bottom",
|
|
0 commit comments