我不知道为什么当我将项目拖到可放置区域时会触发以下警告?
$(".all").droppable({
drop: function(event, ui) {
alert('should just fire when a item is dropped');
}
});
$("li").draggable({
connectToSortable : ".mySortable",
helper : "clone",
revert : "invalid",
scroll: true,
cursor: 'move'//,
}
});
这是被调用的调用堆栈中最远的行:
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
包含在jquery-1.7.2.js
中该行代码在:
之内if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
如果将此代码粘贴到小提琴 - jsfiddle.net/Xz3u2中,则应重新创建错误:
$(".all2").sortable({
revert : true
});
$(".all").droppable({
drop: function(event, ui) {
alert('should just fire when a item is dropped');
}
});
$(".all2").draggable({
connectToSortable : ".all2",
});
答案 0 :(得分:0)
尝试这样:http://jsfiddle.net/Xz3u2/2/
$(".all2").sortable({
revert : true
}).draggable();
$(".all").droppable({
accept: '.all2',
drop: function(event, ui) {
alert('should just fire when a item is dropped');
}
});