javascript – 检查(‘div’)mouseenter on(‘a’)mouseleave

我的问题如下:
我有一个触发器(a)和一个弹出窗口(div). div不嵌套在锚内.

>当我将鼠标悬停在a上时,我希望div显示出来.
>当我从a到div时,我希望它保持可见.
>当我离开div时,我希望它关闭.
>当我将鼠标悬停在a并且不进入div时离开时,我希望div关闭.

我得到了大部分的结果,但是现在我已经满怀希望了. 2.
当检查a上的mouseleave时,我检查div上是否有mouseenter.如果是,我想中止mouseleave.如果没有,我想关闭div.

我究竟做错了什么?这甚至是正确的方法吗?

这是标记

这是jQuery:

$('.popup_toggle').mouseenter(function() {
        var element = $(this).next('.popup_div');
        $.data(this,'timer',setTimeout(function() {
            element.show(100);
        },500));
    });

    $('.popup_toggle').mouseleave(function() {
        clearTimeout($.data(this,'timer'));
            if($('.popup_div').mouseenter==true)
            {
                return false;
            }
            else
            {
                $('.popup_div').hide(100)
            };
    });
最佳答案

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...