Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
搞定mouseover和mouseout兼容性的代码
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