jquery Draggable -- 动画“克隆”掉落时
我正在构建一个小部件,它允许用户将项目从一个列表复制到另一个列表,但可以拖动。
我已经找到了助手:“克隆”选项将允许我拖动可拖动对象的副本,而不是可拖动对象本身。我想让克隆在我将其放到可放置物体上时进行动画/捕捉到位,但一旦我释放它,它似乎就会被破坏。我怎样才能防止它被破坏,以便在它发布时我可以自己制作动画?
我意识到 Sortable 可能会给我一些我想要的功能,但随后我的列表将变得可排序,这是我不想要的。我只想要简单的副本 ->发布->快照功能。
I'm building a widget which allows user to copy items from one list over to another, but dragging.
I've figured out the helper: 'clone' option will allow me to drag a copy of my draggable, rather than the draggable itself. I'd like to have the clone animate/snap in to place when I drop it on my droppable, but it seems to be destroyed as soon as I release it. How can I prevent its destruction so I can animate it myself when it's released?
I realize Sortable might give me some of the functionality I want, but then my lists will become sortable, which I don't want. I just want simple copy -> release - > snap functionality.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 drop 的回调函数上,执行以下操作:
如果这还不够,请告诉我。
On the callback function for drop, do something like:
Let me know if that's not sufficient.
我在 Doctype 上回答了类似的问题,其中包括 此演示。它使用的是可拖动和可放置的,而不是像您在问题中所描述的那样可排序。我不确定您使用的是哪一种,但为克隆设置动画的方法是相似的。
I answered a similar question on Doctype which included this demo. It uses draggable and droppable though, and not sortable as you described in your question. I wasn't sure which one you are using, but the method to animate the clone is similar.