-->

mouseenter, mouseleave in Firefox

2019-07-19 05:33发布

问题:

I'm facing a strange issue in Firefox 16.

In a div I'm fading in on a mouseenter (and fade out on mouseleave) event there is a select Tag embedded. When I move the mouse over the options the div fades out and in and so on. But there is no chance to select a option.

This does not happen in Chrome. Has anyone an idea why this is happening and how to fix it?

Fiddle: http://jsfiddle.net/sCmnd/2/

回答1:

Try that: http://jsfiddle.net/sCmnd/3/ . I tested it on Firefox and it worked.

mouseleave:function(evt) {
    if (evt.target.nodeName.toLowerCase() !== "select") {
        $('div.fade').fadeOut();
    }
}

For some reason mouseleave triggers on select element, but this doesn't allow fadeout when mouseleave is triggered by select element.