Because of the browser's bubbling behavior. Cause if mouseover,mouseout is defined on a DIV element at the same time, when the mouse moves to the child element in the Div, two operations mouseover and Mouseout are performed simultaneously.
Solution: block the bubbling behavior and do not trigger the mouseout operation when the mouseover is executed.
Method 1:
Deferred execution (setTimeout), cancellation delay (cleartimeout), is deferred execution when Mouseout, and cancellation of deferred execution at MouseOver. Mouseout is not triggered when the mouse moves over the div because of deferred execution.
$ (' div '). Mouseout (function () { cleartimeout (t); T=settimeout (zoomin,400); }). MouseOver (function () { if (t!=null) cleartimeout (t); T=null;
Method 2:jquery (requires version number greater than 1.2.2)
MouseEnter and MouseLeave event IE-specific functions, using jquery is a good solution to the compatibility problem. The principle of the function is triggered when the mouse enters the node area for the first time, and is not triggered when it is moved within the node area (between child nodes).
$ (' div '). Mouseout (function () { cleartimeout (t); T=settimeout (zoomin,400); }). MouseOver (function () { if (t!=null) cleartimeout (t); T=null;
jquery version >1.4 simplified notation:
$ (' div '). Mouseout (function () { cleartimeout (t); T=settimeout (zoomin,400); }). MouseOver (function () { if (t!=null) cleartimeout (t); T=null;
The flicker problem of jquery caused by mouseover,mouseout bubbling