javascript - programmatically calling drag event from function draggable() in jQuery -
i have following code in java script file. need trigger drag event pragmatically not able to.
$(".toolitems").draggable({ drag: function (event, ui) { alert(); }, stop: function (event, ui) { removetoolitem(event, ui); } });
i trying call in following manner
function createevt1() { var evt1 = $.event('drag'); evt1.clientx = 20; evt1.clienty = 30; $('.toolitems').trigger("drag",evt1); }
but working
try this:
function createevt1() { var evt1 = $.event('drag'); evt1.clientx = 20; evt1.clienty = 30; makedraggable('.toolitems'); } function makedraggable(selector){ $(selector).draggable({ drag: function (event, ui) { alert("dragging"); }, stop: function (event, ui) { alert("stopping"); } }); }
Comments
Post a Comment