If i have an object that is draggable and has Start, Drag, Stop functions, how would i trigger them?
the issue that i am thinking would cause issues is the arguments passed into the function.
I wasn't sure if there was an easy way to do this, if there was some sort of simulation that can be used, or if i should create a custom object in which would be passed into the e and ui function attributes.
I would write code, but it is as simple as:
Code:
var $a = $("<div />").append("Test Text").appendTo("body").draggable({
start: function(e,ui){/*...*/},
drag: function (e,ui){/*...*/},
stop: function (e,ui){/*...*/}
});
I wanted to call the functions, and originally i was thinking:
$a.draggable("option", "start")();
$a.draggable("option", "drag")();
$a.draggable("option", "stop")();
I just did a quick code walk, to see which arguments were being used where.
start: ui.position.top|left
drag: ui.position.top|left
stop: ui.position.top|left, eventArgs.ClientX, eventArgs.ClientY, eventArgs.target
All of these have things like scope, and this, but since it is properly attached to something calling a click would be different then just calling the function without a reference to the object at hand.
After looking at the functions, I SHOULD be able to just create objects to pass into the trigger OR function as i have fired it in the above statement.