Jquery ui, call start drag manually

Jan picture Jan · Apr 8, 2009 · Viewed 10.1k times · Source

In Jquery UI I can configure an element as draggable by invoking

$("#drag").draggable();

But is there a way to start and stop the drag functions manually from another function? Ie

someOtherFunction = function() {
  $("#drag").startdrag();
}
yetAnotherFunction = function() {
  $("#drag").stopdrag();
}

Answer

John Milmine picture John Milmine · May 23, 2011

Answers above seem overcomplicated.

$('.nonDraggableObjectWhichTriggersDrag').mousedown(function(e) {
    $('.draggableObject').trigger(e); 
});