jquery UI 可拖动助手:克隆从原始中删除可拖动?
Posted
技术标签:
【中文标题】jquery UI 可拖动助手:克隆从原始中删除可拖动?【英文标题】:jquery UI draggable helper: clone removes draggable from original? 【发布时间】:2011-07-15 13:02:53 【问题描述】:我正在使用具有以下选项的可拖动:
$("#accountDetailPanel .draggable").draggable(
helper: 'clone',
appendTo: 'body',
cursor: 'move',
revert: 'invalid'
);
$(".accountPod").droppable( accept: '.draggable' );
我在加载时将可拖动应用到 jquery UI 选项卡的第二个选项卡的内容:
问题只是第一次拖动可以正常工作。当我不将可拖动对象拖放到可接受的可拖放对象中时,吊舱会恢复原状,但我无法再进行拖动。无论如何,被拖动的 pod 都失去了可拖动性。
在尝试对可拖动的 init 应用停止函数时,我走上了需要嵌套无限 .draggable 调用的道路。
完整的脚本:
$(document).ready(function()
$("#tabs").tabs();
/**
* Click on account pod -> account detail pane is populated
* Inside account detail, tabs pulled dynamically
* Installation List - each installation (home) is movable
*/
$(".accountPod").live("click", function(event)
var account_id = $(this).attr("id").replace("acct_", "");
// load user's details into tab panel (replace all tabs)
$("#accountDetailPanel").load("/accountDetail/" + account_id, function()
// post-load of tabs html
$("#tabs").tabs();
// init draggables
$("#accountDetailPanel .draggable").draggable(
helper: 'clone',
appendTo: 'body',
cursor: 'move',
revert: 'invalid'
);
$(".accountPod").droppable( accept: '.draggable' );
);
);
);
由于这个小提琴有效:http://jsfiddle.net/notbrain/DycY6/41/ 我肯定认为它与加载选项卡时 .draggable() 的动态应用有关。
任何指针都非常感谢!
【问题讨论】:
【参考方案1】:不幸的是,我认为问题在于正在加载的库。我发现使用 jQuery 1.8.5 和 jQuery-git.js 有效。
【讨论】:
以上是关于jquery UI 可拖动助手:克隆从原始中删除可拖动?的主要内容,如果未能解决你的问题,请参考以下文章