Mouseover and mouseout events are triggered multiple times as the binding element passes through

  • 2020-03-30 02:11:51
  • OfStack

Javascript mouseover and mouseout events, where there are child elements inside the binding element,

Mouseover and mouseout events are triggered multiple times as the binding element passes through.

Jquery solutions:

Jquery's mouseenter and mouseleave methods have fixed this problem and can be used directly to replace mouseover and mouseout

A minor problem with mouseenter and mouseleave, however, is that the mouseenter does not take effect when the mouse enters the element of the bound event directly from outside the document

For the time being, keep the elements that bind events away from the browser's edge and try to leave at least 1px space between them.

In addition, jquery's hover() method USES mouseenter and mouseleave. You can also solve mouseover and mouseout problems.

Related articles: