Uttara
Uttara

Reputation: 2532

How to get the handle used to drag a draggable when having multiple handles

I am using Jquery Draggable
My draggable is having four handles on all four sides viz (top, bottom, left and right) using which draggable can be dragged in respective direction

$('.draggable').draggable({
    handle: '.top, .bottom, .left, .right'
});

Well I can get the direction of drag and set the axis once the drag starts, but what if bottom handle is being used to drag to left direction.

So is there any way to know which handle is being used to drag a draggable?

Upvotes: 1

Views: 265

Answers (1)

Uttara
Uttara

Reputation: 2532

Well I got an answer to my question, and I am posting it here so as to help others in future

$('. draggable').draggable({
    handle: '.top, .bottom, .left, .right'
    start : function(event, ui) 
    {
        console.log(event.originalEvent.target);
                 //OR
        console.log(event.originalEvent.originalEvent.explicitOriginalTarget);
    }
});

Upvotes: 1

Related Questions