Home > Web Front-end > JS Tutorial > body text

The mouseover and mouseout events will be triggered multiple times after binding elements_javascript tips

WBOY
Release: 2016-05-16 16:57:53
Original
1353 people have browsed it

JavaScript's mouseover and mouseout events, when there are child elements inside the bound element, the mouseover and mouseout events will be triggered multiple times when

passes the bound element.

jquery solution:

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

But there is a mouseenter and mouseleave A small problem is that when the mouse enters the element bound to the event directly from outside the document, the mouseenter does not take effect

The temporary solution is to keep the element bound to the event away from the edge of the browser and try to leave at least 1px spacing. .

In addition, jquery’s hover() method is equivalent to using mouseenter and mouseleave. It can also solve the problems of mouseover and mouseout.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template