10 Mar 2010, 00:09
Img_0013_pragsmall

Xavier Décoret (5 posts)

I am trying to do exactly what is described section 15.3: you have food items on a shelf that you can drag to a menu. Dragging is not used to move object from one place to another but to add something to a container (another example would be to drag a tag on a picture to add the tag to the picture).

This case is mentionned in 15.3, but unfortunately no example is given ;-). So I rolled up my sleeves and try to do it myself.

The problem I immediately encountered is that I cannot use onStart, onEnd, starteffect, endeffect, or reverteffect. Indeed, if I do


<span class='handle'>[drag]</span>
            <%=h resource.name %>
            <%= draggable_element(id, 
                :ghosting=>false, 
                :revert=>true, 
                :handle => "'handle'",
                :reverteffect => "new Effect.DropOut('#{id}')") %>

then the dropout takes place when the page is loaded ?!

Any help would be greatly appreciated.

10 Mar 2010, 00:17
Img_0013_pragsmall

Xavier Décoret (5 posts)

Ok. I found the solution right after asking (like they say in “Debug It!” from pragprog ;-)).

It should be:


:reverteffect => "function () { new Effect.DropOut('#{id}') }" 

Now I can start implementing the effect I want. Now the subsidiary question would be: if ghosting is enabled, what is the DOM id, if any, of the copy element that is moved/stays in place?

  You must be logged in to comment