jQuery 可拖动到可排序仅在排序后才起作用
我在使用 Draggable 和 Sortable 的简单组合时遇到问题:最初,拖动不起作用,并且我没有收到接收回调。只有在我完成了排序(即更改#workarea中事物的位置)后,我才能将新事物拖入其中。
不知何故,似乎可排序需要在接受可拖动之前“初始化”。我的代码,简化版本:
$(".element_draggable").draggable({
zIndex: 2,
helper: 'clone',
connectToSortable: '#workarea'});
$("#workarea").sortable({
receive: function() {alert('received');}
});
有人知道我在这里可能做错了什么吗?
I'm experiencing problems with a simple combination of a Draggable and Sortable: initially, the dragging does not work and I do not get a receive callback. Only after I have done a sort (i.e. change the position of things in #workarea), can I drag new things into it.
Somehow it seems as if the sortable needs to be 'initialized' before it accepts draggables. My code, in a simplified version:
$(".element_draggable").draggable({
zIndex: 2,
helper: 'clone',
connectToSortable: '#workarea'});
$("#workarea").sortable({
receive: function() {alert('received');}
});
Does anyone have an idea on what I could be doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论