I only want to know when the mouse has left the containing DIV.
But if you either move the mouse over a textbox really fast or move the mouse over the scrollbar of a div, the events fire.
I only want to know when the mouse has left the containing DIV.
But if you either move the mouse over a textbox really fast or move the mouse over the scrollbar of a div, the events fire.
I tried the following with hover.
It seems to suffer from the same issue only in Firefox.
javascript
jquery
firefox
mouseleave
mouseenter
Share
Improve this question
edited Jan 28, 2010 at 22:11Stanley.Goldman
asked Jan 28, 2010 at 21:58
Stanley.GoldmanStanley.Goldman4,33722 gold badges2424 silver badges2525 bronze badges
Add a ment
|
2 Answers
2
Reset to default
2
This behavior is related to a firefox bug, that has been fixed in Firefox 3.6. jQuery tries to handle this bug with withinElement function (search through jQuery source code), but the solution isn't perfect.
I almost always find that it's better to use the hover() method or the hoverIntent() plugin rather than separate mouseenter/mouseleave handlers if you are planning to do things both when the mouse enters and leaves an element. Both of these seem to handle the range of possible mouse movement events rather than just mapping onto mouseenter/mouseleave.