4

[JavaScript] Comparison of MouseEnter MouseLeave MouseOver MouseOut

 2 years ago
source link: http://siongui.github.io/2012/08/07/javascript-compare-mouseenter-mouseleave-mouseover-mouseout/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[JavaScript] Comparison of MouseEnter MouseLeave MouseOver MouseOut

Updated: February 26, 2015

onmouseenter / onmouseleave event of a DOM element will be triggered only when the mouse cursor enters / leaves the element:

Demo of MouseEnter & MouseLeave event

onmouseover / onmouseout event of a DOM element will be triggered not only when the mouse cursor enters / leaves the element, but also when the mouse cursor enters / leaves sub-elements of the element.

Demo of MouseOver & MouseOut event


See also: [JavaScript] onMouseEnter and onMouseLeave Suppport for Old Browsers


References:

[1]Mouse Events - QuirksMode

[2]javascript - What is the difference between the mouseover and mouseenter events? - Stack Overflow


Author: Siong-Ui Te Category: JavaScript

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK