views:

49

answers:

2

My logic is

if( !this.draginited() ) // a drag-disabled element shouldn't get pass here, as it is inited
  this.draggable({...})

I searched a lot and couldn't find a way to implement this logic, any ideas?

+9  A: 

Maybe there's an easier way, but the docs say:

Draggable elements gets a class of ui-draggable

so you could do something like:

if(!$("#foo").hasClass("ui-draggable")) {
    ...
}

so to wrap that up (untested):

$.fn.isDraggable = function() {
    return $(this).hasClass("ui-draggable");
}

console.log($("#someElement").isDraggable());
karim79
I suddenly feel myself so stupid..., thanks so much!
Edward
A: 

The dragstart event is fired when dragging is started. More in the docs

Pickle