@@ -26,6 +26,7 @@ jQuery.fn.contextPopup = function(menuData) {
2626 // Define default settings
2727 var settings = {
2828 contextMenuClass : 'contextMenuPlugin' ,
29+ linkClickerClass : 'contextMenuLink' ,
2930 gutterLineClass : 'gutterLine' ,
3031 headerClass : 'header' ,
3132 seperatorClass : 'divider' ,
@@ -45,22 +46,22 @@ jQuery.fn.contextPopup = function(menuData) {
4546 }
4647 settings . items . forEach ( function ( item ) {
4748 if ( item ) {
48- var rowCode = '<li><a href="#"><span></span></a></li>' ;
49+ var rowCode = '<li><a href="#" class="' + settings . linkClickerClass + '" ><span class="itemTitle" ></span></a></li>';
4950 // if(item.icon)
5051 // rowCode += '<img>';
5152 // rowCode += '<span></span></a></li>';
5253 var row = $ ( rowCode ) . appendTo ( menu ) ;
5354 if ( item . icon ) {
5455 var icon = $ ( '<img>' ) ;
5556 icon . attr ( 'src' , item . icon ) ;
56- icon . insertBefore ( row . find ( 'span ' ) ) ;
57+ icon . insertBefore ( row . find ( '.itemTitle ' ) ) ;
5758 }
58- row . find ( 'span ' ) . text ( item . label ) ;
59+ row . find ( '.itemTitle ' ) . text ( item . label ) ;
5960
6061 if ( item . isEnabled != undefined && ! item . isEnabled ( ) ) {
6162 row . addClass ( 'disabled' ) ;
6263 } else if ( item . action ) {
63- row . find ( 'a' ) . click ( function ( ) { item . action ( e ) ; } ) ;
64+ row . find ( '.' + settings . linkClickerClass ) . click ( function ( ) { item . action ( e ) ; } ) ;
6465 }
6566
6667 } else {
@@ -72,7 +73,7 @@ jQuery.fn.contextPopup = function(menuData) {
7273 }
7374
7475 // On contextmenu event (right click)
75- this . bind ( 'contextmenu' , function ( e ) {
76+ this . on ( 'contextmenu' , function ( e ) {
7677 var menu = createMenu ( e )
7778 . show ( ) ;
7879
@@ -87,13 +88,13 @@ jQuery.fn.contextPopup = function(menuData) {
8788
8889 // Create and show menu
8990 menu . css ( { zIndex :1000001 , left :left , top :top } )
90- . bind ( 'contextmenu' , function ( ) { return false ; } ) ;
91+ . on ( 'contextmenu' , function ( ) { return false ; } ) ;
9192
9293 // Cover rest of page with invisible div that when clicked will cancel the popup.
9394 var bg = $ ( '<div></div>' )
9495 . css ( { left :0 , top :0 , width :'100%' , height :'100%' , position :'absolute' , zIndex :1000000 } )
9596 . appendTo ( document . body )
96- . bind ( 'contextmenu click' , function ( ) {
97+ . on ( 'contextmenu click' , function ( ) {
9798 // If click or right click anywhere else on page: remove clean up.
9899 bg . remove ( ) ;
99100 menu . remove ( ) ;
0 commit comments