开发者

hidding a draggable after dropping it (scriptaculous)

probably best if i first just write my code down. i have:

<li class="sorted" id='<%= domid %>'>
    <%= horse.name %>
</li>
<%= draggable_element(domid, :ghosting=>true) %>

after the drop on some "box" the draggable element with name = horse.name stays on it. i want to delete it(the name). i was trying different things.

supposedly i will have to write plain javascript(i am not sure if thats the case but) if i do that i have problems with getting the parent element id that i have to insert in js.

var mydrag = new Draggable(domid, { ghosting: true });
// then destroy it when you don't need it anymore
mydrag.dest开发者_StackOverflow中文版roy();

how can i get proper domid. sth like this.parentNode.id? i also tried

 <%= draggable_element(domid, :ghosting=>true, :endeffect => "this.hide();") %>

without success.

so my question is how to remove the element after drag?


You can use endeffect, like this:

var mydrag = new Draggable(domid, { ghosting: true, endeffect:function() { $(domid).hide() } });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜