View Full Version : DragDrop: Is it possible to change the cursor while dragging

27 Jul 2009, 8:19 AM
Hi all,

I want to indicate to the user that an object cannot be dropped on a specific area and change the cursor css to 'not-allowed' when the object is over such an area.

Is this possible at all? I mean changing the cursor css while dragging something?


27 Jul 2009, 8:44 AM
The DD classes handle this for you. They add use-defineable CSS class names to the proxy which represents dragged data depending on return status from your event handling routines (onDragOver etc)

Run and read the examples in your examples/dd directory.

27 Jul 2009, 9:48 AM
Thanks for your response,

But none of the examples are using custom css to change the cursor (or I can't find it...) and all of them are having this additional indicator in the top left corner of the drag proxy.

I could change all page elements except the drop zone to have the css this.style.cursor='not-allowed', but then when the object is dropped I would need to restore the previous css again - not really nice...

27 Jul 2009, 10:22 AM
You will have to programatically change the document.body cursor to "no-drop" on drag start, and change it onDragEnter and onDragOut

27 Jul 2009, 10:25 AM
But the class on the drag proxy shows whether it's allowed:


27 Jul 2009, 10:29 AM
True, there might be a good reason for using this additional indicator and not change the mouse cursor.

Thanks a lot.