mouseenter mouseleave and a select

試著忘記壹切 提交于 2019-12-02 05:00:54

问题


http://jsfiddle.net/msNhr/

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.

Thanks!


回答1:


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

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

relevant js

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


来源:https://stackoverflow.com/questions/11781518/mouseenter-mouseleave-and-a-select

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!