jQuery droppable out事件无法触发? [英] jQuery droppable out event fails to trigger?
问题描述
$(".LWdrop").droppable({
accept: ".LW",
drop: function(event, ui){
ui.draggable.addClass("LWactive");
$(this).droppable('option', 'accept','');
$(this).css("background-color", "#444444");
},
out: function(event, ui){
$(this).droppable('option', 'accept', '.LW');
ui.draggable.removeClass("LWactive");
},
activate: function(event, ui){
$(this).css("background-color", "blue");
},
deactivate: function(event, ui){
$(this).css("background-color", "#444444");
}
});
请忽略激活/停用时丑陋的背景颜色变化,这仅用于测试。我遇到了out没有被触发的问题。这可能与draggables设置为revert:invalid的事实有关吗?即使删除它,我也无法从out事件中获得任何内容......甚至是一个简单的警告框。任何提示?
Please ignore the ugly background-color changes on activate/deactivate, that's only for testing. I'm having a problem where "out" isn't being triggered. Could this have to do with the fact that the draggables are set to "revert: invalid"? Even removing that, I fail to get anything from the out event to execute...even a simple alert box. Any tips?
推荐答案
当您将鼠标悬停在时会触发 out 事件可拖动的
超过 droppable
,然后将其移走。不幸的是,当您拖动 draggable
时,不会这样做。
The event out is triggerd when you hover a draggable
over a droppable
and then move it away. Unfortunately not when you drag a draggable
away.
这篇关于jQuery droppable out事件无法触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!