Here's an example using the hacked source that starts dragging one element when you click (mousedown) on another element. Notice the null value passed as the undocumented "fn" parameter:
<html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Programmatic Draggable</title> <script type="text/javascript" src="../js/jquery.js"></script> <script type="text/javascript" src="../js/jquery.ui-1.0/ jquery.dimensions.js"></script> <script type="text/javascript" src="../js/jquery.ui-1.0/ui.mouse.js"></ script> <script type="text/javascript" src="../js/jquery.ui-1.0/ ui.draggable.js"></script> <script type="text/javascript" src="../js/jquery.ui-1.0/ ui.draggable.ext.js"></script> <script type="text/javascript"> $(document).ready(function(){ //bind event for one fire $("#programmatic").one("mousedown", function(e){ //make draggable element draggable $("#draggable").draggable(); //trigger a mousedown to start a drag $("#draggable").trigger("mousedown", [],null,{srcElement:$ ("#draggable"),which:e.which,pageX:e.pageX,pageY:e.pageY}); }); }); </script> <style type="text/css"> #draggable{ width:100px; height:100px; background-color:#aa0000; } #programmatic{ width:100px; height:100px; background-color:#00aa00; } </style> </head> <body> <div id="draggable">draggable</div> <div id="programmatic">by dragging here</div> </body> </html> On Feb 4, 5:03 pm, B <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to also trigger the draggable from within a javascript > function. If possible can you please share your source hack. > > Thanks > > On Jan 29, 2:49 pm, edwardbaafi <[EMAIL PROTECTED]> wrote: > > > >http://docs.jquery.com/Eventshasmousedown, mouseup, mousemove, etc > > > Yes, you are able to trigger these events using "trigger( type, > > data )", but what about setting the event properties? > > > In my case, when an element is "draggable" and it's mousedown event > > fires, the > > click function in ui.mouse.js is called.. A number of properties of > > the event, like e.which, e.target, e.srcElement, e.pageX, e.pageY are > > needed but at least some of these properties are undefined.. > > > Is it possible to set these properties when calling > > trigger('mousedown') or with some other unpublished way? > > > Thanks, > > > Ed