当可拖放对象出现在可放置区域时,我们如何获取可拖动对象的拖动事件?实际上,droppable 的 over 事件并没有捕捉到拖动对象的拖动事件。任何人都可以为此建议我。谢谢
$("#draggable").draggable({
revert: true,
drag: function (event, ui) {
//console.log(ui.offset); ---------> Works fine
},
stop: function (event, ui) {}
});
$("#droppable").droppable({
activeClass: "drop-active",
hoverClass: "drop-hover",
accept: "#draggable",
tolerance: "fit",
drop: function (event, ui) {
$("<div></div>").text(ui.draggable.text()).appendTo(this);
},
out: function (event, ui) {
console.log('out');
},
over: function (event, ui) {
var dragItem = ui.draggable;
var dragOffset = ui.offset;
//console.log(dragOffset); ---------> not getting drag events param
},
});