When an element is bound, the mouseover and mouseout events are triggered multiple times.
When an element is bound, the mouseover and mouseout events are triggered multiple times. To solve this problem, the following is a good solution.
Javascript mouseover and mouseout events, when the bound element contains child elements,
When an element is bound, the mouseover and mouseout events are triggered multiple times.
Jquery solution:
The mouseenter and mouseleave methods of jquery have fixed this problem and can be used directly to replace mouseover and mouseout.
However, there is a small problem between mouseenter and mouseleave: When the mouse enters the element of the binding event from outside the document, the mouseenter does not take effect.
The temporary solution is to leave at least 1 px spacing between elements bound to events on the edge of the browser.
In addition, the hover () method of jquery is equivalent to using mouseenter and mouseleave. It can also solve the problems of mouseover and mouseout.