tags:

views:

620

answers:

1

I can drag my draggable items and drop them on my droppables and get the drop position from ui.absolutePosition on the drop event. I need to know what position the drag started from. I have tried getting ui.position on the drag start event but this is null. I've also tried ui.position on the drag event but this is undefined.

Any ideas?

+1  A: 

You should be able to use the ui.draggable from the .droppable's drop function to get what you're after.

ui.draggable.offset()

perhaps.

If you want the exact mouse position on start of drag, you can use the event.clientX and event.clientY on the .draggable() start function

$('selector').draggable({ ...options...
      start: function(event, ui) {
                   alert("You clicked x:" + event.clientX + " y:" + event.clientY);
             }
});
Marc
Thanks. Saving the client.x, client.y gives what I need.
WJS