I have an image that I customized using the jQuery UI that you can drag and drop. This works great, but now I would like to be able to drag around the image to draw a rectangle in the image and not move. Therefore, if the Shift key is held down, I do not want to do drag and drop.
I tried to put
if(e.shiftKey)return;
at the top of the drag_start, dragging, and drag_stop functions, but it doesnβt do anything, because the drag and drop operation seems to be performed inside the jQuery UI, and the drag_start, drag and drop and drag_stop calls are just courtesy calls letting you know what jQueryUI does .
Is there a way to disable drag and drop while holding the Shift key?
thanks
(For more information about this, see my "answer" below using jsfiddle.)
source share