functioncontains (parentnode, Childnode) {if(parentnode.contains) {returnParentNode! = Childnode &&Parentnode.contains (Childnode); } Else { return!! (Parentnode.comparedocumentposition (childnode) & 16); } } functionCheckhover (e,target) {if(GetEvent (E). type== "MouseOver") { return!contains (Target,getevent (E). relatedtarget| | GetEvent (E). fromelement) &&! ((GetEvent (E). relatedtarget| | GetEvent (E). fromelement) = = =target); } Else { return!contains (Target,getevent (E). relatedtarget| | GetEvent (E). toelement) &&! ((GetEvent (E). relatedtarget| | GetEvent (E). toelement) = = =target); } }functionGetEvent (e) {returne| |window.event; }
How to use: $ ("a"). Bind ("Mouserover", function () {
if (!checkhover (e,this)) return;
});
The original source I forgot, anyway, is a blog in the Garden of a Daniel.
Clear child element inherit parent element mouse move in move out event