Determining Direction Of Drag
I'm trying to determine the direction that an object is being dragged so that I can make a decision to do something based on the direction of the drag. The code below is what I have come across but it does not do what I'm looking for.
- $(".draggable").draggable({
- start: function(event, ui) {
- startX = ui.position.left;
- startY = ui.position.top;
- },
- stop: function(event, ui) {
- stopX = ui.position.left;
- stopY = ui.position.top;
- }
- });
I would like to know the direction of the drag as soon as the object is moving not after it had stopped.