Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function isMouseLeaveOrEnter(e, handler) {
if (e.type != 'mouseout' && e.type != 'mouseover') return false;
var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement;
while (reltg && reltg != handler)
reltg = reltg.parentNode;
return (reltg != handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment