检测jQuery UI的可拖动功能悬停在什么位置 [英] Detecting what jQuery UI's draggable function is hovering over

查看:109
本文介绍了检测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
     } 
});

这篇关于检测jQuery UI的可拖动功能悬停在什么位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆