1

I have a situation in which a node (Raphael rect) has event drag attached to it.

r4.drag(dragMove, dragStart, dragStop);

In dragStop handler I am distinguishing between drag and rightclick events

if (editLabelFlag == false) {
    if (event.which == 3) {
        event.preventDefault();
        $('#contextmenu').slideDown('fast').delay(1000).slideUp();
        // code for
    }
} else {
    // drag code
}

I am setting the editLabelFlag to true in the dragMove handler to distinguish between drag and click To stop showing the browser context menu I have given event.preventDefault().

The problem I am facing is that this happens flawlessly for the first time and for all later right clicks on the node I get only the browser context menu. I have checked in Firebug and see that the contextmenu div always remains display none and only the first time it becomes display block. I have tried using the return false instead of event.preventDefault but that shows my menu below the browsers menu.

Is the preventDefault causing this problem? Please provide some

Eliran Malka
  • 15,821
  • 6
  • 77
  • 100
kavita
  • 845
  • 4
  • 14
  • 40
  • This post might be useful: http://stackoverflow.com/a/706728/239380 – keegan3d Apr 10 '12 at 08:18
  • none of the answers or the question refers to event not being handled after the first time! What my code does is similar to the last answer posted by Simon – kavita Apr 10 '12 at 08:37

1 Answers1

1

It was not due to the browser stopping any events, actually I was creating a clone and dragging the original. In dragstart the clone was put in originals place and not removed during click. Hence no events mapped for original worked for clone and hence the click happened only once.

Thanks for your time

kavita
  • 845
  • 4
  • 14
  • 40