【发布时间】:2013-06-17 02:58:16
【问题描述】:
我正在尝试让拖动的元素检测其悬停在 jQuery 的 UI 可拖动功能的 stop 事件上的位置。这是我的尝试,但无济于事:
$(".artwork").draggable({
stop: function(e, ui){
ui.mouseover(function(f){
if(f.target.id == "wall")
{
alert("yes!");
}
});
}
});
我不太确定我是否完全理解如何能够检测到我悬停在拖动的 stop 事件上的元素。
谢谢!
【问题讨论】:
-
你用 console.log(ui) 看看你得到了什么吗?
-
ui.helper.context是为您提供当前拖动元素的原因,我认为您甚至需要在其中注册鼠标悬停。 -
你想做什么?你也在用droppable插件吗?
-
我没有使用 droppable 插件,只是使用 draggable。生病看看
ui.helper.context。 -
ui.helper.context代码返回被拖动元素的名称。我想要那个元素悬停在stop事件上。
标签: jquery jquery-ui-draggable