[英]Drag and Drop / Sortable jQuery Ui Live - must be on, does not work
在过去的几年中,我可以使用以下代码来处理现场事件以及拖放或可排序:
(function ($) {
$.fn.liveSortable = function (opts) {
this.live("mouseover", function() {
if (!$(this).data("init")) {
$(this).data("init", true).sortable(opts);
}
});
};
}(jQuery));
但是不推荐使用“实时”事件,并且在新的jQuery版本中不起作用。 我尝试将活动事件替换为活动事件,但是仍然出现错误消息: TypeError: n is undefined
(function ($) {
$.fn.liveSortable = function (opts) {
$(document).on("mouseover",this, function () {
if (!$(this).data("init")) {
$(this).data("init", true).sortable(opts);
}
});
};
}(jQuery));
您对我有什么建议吗?
- - - - - - - -编辑 - - - - - - - - - - - - - - -
我为我找到了另一个解决方案:
$(document).on("mouseover",".draggable", function () {
$( ".draggable" ).draggable({opt});
});
什么时候出现错误? 也许其他地方出了问题。 我here
没有任何错误: http : //jsfiddle.net/TSv6Z/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.