JQuery context clash with jQuery Draggable

I'm trying a jQuery context menu with jQuery Draggable rows in jQGrid .

The problem I'm facing is that since I added the jQuery context menu , the drag and drop action is triggered with one click (as well as normal drag). It looks a little strange when I select a line to get the menu, and then go beyond it to another line (to cancel the menu), and this line starts with the cursor.

Is this related evt.stopPropagation();to the following jQuery context menu snippet?

$(this).mousedown( function(e) {
    var evt = e;
    evt.stopPropagation();
    $(this).mouseup( function(e) {
        e.stopPropagation();
        var srcElement = $(this);
        $(this).unbind('mouseup');
        if( evt.button == 2 ) {
            // Hide context menus that may be showing
            $(".contextMenu").hide();

Is there anything I could do besides choosing between a drag-and-drop or context menu?

+5
2

- . ( div, div) , - , div. . draggability, , .

, , , :

jQuery(this).mousedown( function(e) {
    var evt = e;
    if (e.button == 2) //Added to make this compatible with draggable
        evt.stopPropagation();
    jQuery(this).mouseup( function(e) {
        if (e.button == 2) //Added to make this compatible with draggable
            e.stopPropagation();
        var srcElement = jQuery(this);

e.button == 2 , divs , . IE8 , , , , .

== == EDIT

Carl R Chrome:

jQuery(this).mousedown( function(e) {
    var evt = e;
    if (e.button != 2) return; //Added to make this compatible with draggable
    evt.stopPropagation();
    jQuery(this).mouseup( function(e) {
        e.stopPropagation();
        var srcElement = jQuery(this);

, , IE8 .

+9

*.stopPropagation() jquery.contextMenu.js. .

. .preventDefault() . - ?

+4

All Articles