<docbook><section><title>OATDOCghostdrag</title><para> </para>
<title> ghostdrag.js</title> ghostdrag.js
<para>Provides drag&#39;n&#39;drop functionality.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Objects</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GhostDrag()</bridgehead>
<para>Creates a <computeroutput><ulink url="GhostDrag">GhostDrag</ulink></computeroutput> object.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Methods</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GhostDrag::addSource(element, process, callback)</bridgehead>
<para>Mark <computeroutput>selement</computeroutput> as draggable.
 When user drags it, a &quot;ghost&quot; clone is created.
 Then, the <computeroutput>process</computeroutput> function is called with this clone as argument.
 If user drags the clone to one of marked target zones, a <computeroutput>callback</computeroutput> is performed with three arguments <computeroutput>-x,y</computeroutput> and <computeroutput>target</computeroutput> element.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GhostDrag::delSource(element)</bridgehead>
<para>Marks <computeroutput>element</computeroutput> as not draggable.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GhostDrag::clearSources()</bridgehead>
<para>Removes all draggable elements from this <computeroutput><ulink url="GhostDrag">GhostDrag</ulink></computeroutput> object.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GhostDrag::addTarget(element)</bridgehead>
<para>Mark <computeroutput>selement</computeroutput> as a valid ending zone for drag&#39;n&#39;drop.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GhostDrag::delTarget(element)</bridgehead>
<para>Mark <computeroutput>selement</computeroutput> as not a target zone.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GhostDrag::clearTargets()</bridgehead>
<para>Removes all target zones from this <computeroutput><ulink url="GhostDrag">GhostDrag</ulink></computeroutput> object.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Example</bridgehead>
<programlisting>var product = Dom.create(&quot;img&quot;);
var shopping_cart = Dom.create(&quot;div&quot;);
var gd = new OAT.GhostDrag();
var dummyReference = function() {};
var successReference = function(target, x, y) { alert(&quot;Success!&quot;); }
gd.addTarget(shopping_cart);
gr.addSource(product, dummyReference, successReference);
</programlisting><para> <ulink url="CategoryOAT">CategoryOAT</ulink> <ulink url="CategoryDocumentation">CategoryDocumentation</ulink> <ulink url="CategoryOpenSource">CategoryOpenSource</ulink></para>
</section></docbook>