mouseenter mouseleave和一个选择 [英] mouseenter mouseleave and a select

查看:89
本文介绍了mouseenter mouseleave和一个选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://jsfiddle.net/msNhr/

当您浏览aaaaa时,会显示一个叠加层,当您尝试从叠加层中的选择中选择某些内容时。
如何才能做到这一点?

When you go over "aaaaa" an overlay is display, when you try to select something from the select within the overlay closes. How do I get this right?

只有在保留实际的覆盖区域时才能关闭叠加层。

The overlay should only close if the actual overlay area is left.

谢谢!

推荐答案

看到这个小提琴: http://jsfiddle.net/msNhr/3/ (在Fx14和Ch 21.0.1180.57上试用)

see this fiddle: http://jsfiddle.net/msNhr/3/ (tried on Fx14 and Ch 21.0.1180.57)

我刚刚停止传播 mouseleave 事件,因此它不会到达叠加层

I've just stopped the propagation of mouseleave event so it won't reach the overlay

相关的js

$(function() {
    $('#a').mouseenter(function() {
        $('#overlay').show();
    });
    $('#overlay').mouseleave(function() {
        $(this).hide();
    });
    $('#overlay select').mouseleave(function(ev) {
        ev.stopPropagation()
    });
});

这篇关于mouseenter mouseleave和一个选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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