1
這是我到目前爲止有:當一個對象被拖到另一個對象上時檢測?
onMouseMove: function(event) {
clearTimeout(ics.timeout);
ics.timeout = setTimeout(function() {
var mouseX = event.pageX,
mouseY = event.pageY;
$(event.target).parents('li').siblings('li').not('.ui-placeholder').each(function() {
var li = $(this),
leftMin = li.offset().left,
leftMax = parseInt(li.offset().left) + parseInt(li.width()),
topMin = li.offset().top,
topMax = parseInt(li.offset().top) + parseInt(li.height());
var insideX = (mouseX > leftMin && mouseX < leftMax) ? true : false,
insideY = (mouseY > topMin && mouseY < topMax) ? true : false;
if (insideX && insideY) {
console.log('hovering over another item!');
console.log(this);
return false;
}
});
}, 300);
}
這會告訴我,如果事情是盤旋在別的事情了,什麼別的東西,但只是想知道如果有人能拿出一個更好的解決方案?
你當然是一個了不起的人。巧妙地簡單,謝謝。 – 2012-02-13 18:09:05
如果你不使用droppable,你可以使用什麼? (拖拽一個沒有的元素) – KevinDeus 2012-03-11 00:58:39