放置后隐藏可拖动对象(scriptaculous)
如果我首先写下我的代码,可能最好。我有:
<li class="sorted" id='<%= domid %>'>
<%= horse.name %>
</li>
<%= draggable_element(domid, :ghosting=>true) %>
在某个“盒子”上放置后,名称= horse.name 的可拖动元素保留在其上。我想删除它(名字)。我正在尝试不同的事情。
据说我将不得不编写普通的 javascript(我不确定是否是这样,但是)如果我这样做,我在获取必须插入 js 的父元素 id 时遇到问题。
var mydrag = new Draggable(domid, { ghosting: true });
// then destroy it when you don't need it anymore
mydrag.destroy();
我怎样才能得到适当的domid。像这样的.parentNode.id?我也尝试过
<%= draggable_element(domid, :ghosting=>true, :endeffect => "this.hide();") %>
但没有成功。
所以我的问题是如何在拖动后删除元素?
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.destroy();
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 endeffect,如下所示:
You can use endeffect, like this: