jQuery:在可调整大小的可拖动上可放置:项目在放置后消失
我只是用谷歌搜索了很多但找不到答案。
我有一个可调整大小的 div,想在上面放一些东西。到目前为止效果很好。但是当我使用克隆助手时,该项目在掉落时就会消失。我做错了什么?
$('#resizable').droppable({
});
$('.base').draggable({
helper: 'clone',
stack: '#resizable',
containment: '#resizable',
cursor: 'move',
appendTo: '#resizable'
});
我玩过appendTo、accept 等等。我只是无法让它发挥作用......非常感谢任何想法!
I just googled a lot but couldn't find an answer.
I have a resizable div and want to drop something onto it. It works very well so far. But when I use the clone-helper, the item just disappears when dropped. What am I doing wrong?
$('#resizable').droppable({
});
$('.base').draggable({
helper: 'clone',
stack: '#resizable',
containment: '#resizable',
cursor: 'move',
appendTo: '#resizable'
});
I played with appendTo, accept and everything. I just can't get it to work... Any idea is appreciated very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会尝试将以下内容添加到您的 droppable 选项中:
I would try adding the following to your droppable's options:
我们正在主题 使用网格恢复“无效”不会返回到 jQuery UI Draggable 的起始位置 和 @GregL 提供了解决方法这个: http://jsfiddle.net/greglockwood/EBHWr/
我认为这正是你的情况。您需要在
droppable
中定义drop
处理程序。这看起来像是 jQuery 中带有draggable
和helper: "clone"
的错误。We were discussing similar issue in topic revert 'invalid' with grid doesn't return to start position with jQuery UI Draggable and @GregL offered workaround for this: http://jsfiddle.net/greglockwood/EBHWr/
I think this is exactly your situation. You need to define
drop
handler indroppable
. This looks like a bug in jQuery withdraggable
andhelper: "clone"
.