检测jQuery UI的可拖动功能悬停在什么位置

检测jQuery UI的可拖动功能悬停在什么位置

问题描述:

我正在尝试让拖动的元素检测jQuery UI的可拖动功能在stop事件上悬停的位置.这是我的尝试,但无济于事:

I'm attempting to have the dragged element detect where it's hovering over on the stop event for the jQuery's UI draggable function. Here is my attempt, however to no avail:

$(".artwork").draggable({
    stop: function(e, ui){
        ui.mouseover(function(f){
            if(f.target.id == "wall")
            {
                alert("yes!");
            }
        });
    }
 });

我不太确定我是否完全理解在拖动的stop事件中如何检测到我将鼠标悬停在哪个元素上.

I'm not too sure I fully understand how I'd be able to detect what element I'm hovering over on the drag's stop event.

谢谢!

您可能想检查droppable over 事件.

$(".droppable").droppable({
    over: function (event, ui) { 
       var yourCurrentlyHoveredElement = $(this); //the 'this' under over event
     } 
});