1
因爲我可能有一個1000(或更多)DIVS,所有可以被拖放到另一個上,我發現把jquery .droppable放在所有的DIV上頁面加載完成時間太長。因此,我試圖使用mouseover函數將droppable僅添加到用戶實際嘗試放置某些內容的DIV。通過mouseover事件添加Jquery droppable沒有看到OVER事件
這工作正常的下降:但作爲預期過不採取行動:
下面是代碼
$('.nc').mouseover(function() {
$(this).droppable({
tolerance: 'touch',
over: function(event, ui) { // do this .. highlight the div being dropped on // },
out: function(event, ui) { // do this .. unhighlight the div being dropped on // },
drop: function(event, ui) { // do this .. handle the drop even // }
});
});
當我拖放到任意DIV與.NC類的一個片段,這個下降實際上工作正常。然而,當我將一個項目拖到DIV上時,「over」不起作用,除非我的鼠標在嘗試拖動DIV之前已經過了DIV。
請注意,我知道我可以使用hoverClass來突出顯示,但我需要在over事件中提供一些邏輯,以便它僅在特定條件下突出顯示。
我一直在爭取很久,所以希望有人能幫忙。謝謝。
對不起,我的代碼有},在每年年底。我只是忘了把它包含在我的僞代碼中。感謝您的嘗試。我的問題仍然存在。 –