With Jquery,mouseout,mouseover, with the mouse movement, the event was triggered many times, the same as JS Onmouseover,onmouseout. The ultimate solution is to replace mouseover with Jquery,mouseleave instead of Mouseout;mouseenter.
Mouseleave,mouseenter the mouse to leave, triggering the event when entering the outermost label.
Mouseout,mouseover the mouse to leave and enter the inside label when the event triggers.
1, single internal element, no difference
<div id= "Test2" >
</div>
$ ("#test2"). MouseLeave (function () {
Console.log (' out ');
}). MouseEnter (function () {
Console.log (' in ');
});
$ ("#test2"). Mouseout (function () {
Console.log (' out ');
}). mouseover (function () {
Console.log (' in ');
});
The above two code JS code executes separately, the result of execution is the same. Like Mouseover,onmouseover,mouseenter, Mouseout,onmouseout,mouseleave.
2, multiple internal elements, Mouseleave,mouseenter will only execute once
<div id= "Test2" >
<ul>
<li>test</li>
<li>test1</li>
<li>test2</li>
<li>test3</li>
<li>test4</li>
</ul>
</div>
If you change the HTML code to UL this situation, when the mouse enters, leaves the Div, the Mouseleave,mouseenter will only perform once, while the other, with the mouse in the UL between each Li to slide, will be executed.