Home  >  Article  >  Web Front-end  >  javascript onmouseout solution_javascript skills

javascript onmouseout solution_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:23:051067browse

onmouseout found that its triggering was too sensitive. When passing through the text chain in the layer, the onmousetout event was triggered, and the function could not be displayed normally. After some searching, I sorted it out for your reference.

1.

Copy code The code is as follows:


 

  faddsf 


2.
Copy code The code is as follows:

 var LeaveFunext = function(t,f){for(var p in f){t[p]=f[p]} return t};
var IE = 'v' == 'v';
var contains = function(wrap,child){
if(IE) return wrap.contains(child);
while(child && typeof( child.parentNode) != "undefind"){
 if(wrap == child) return true;
 child = child.parentNode;
}
return false;
 };
var LeaveFun = function(o){
var _o = typeof o == "string" ? document.getElementById(o) : o;
return this == window ? new LeaveFun(_o):LeaveFunext(_o , LeaveFun.prototype);
 };
LeaveFun.prototype = {
mouseleave : function(fn){
if(IE){
this.attachEvent('onmouseleave',fn) ;
 }else{
this.addEventListener('mouseout',function(e){
tar = e.relatedTarget;
if(!contains(this, tar)){
fn .call(this);
}
 }, false);
 }
  return this;
 }
 }; ').mouseleave(function(){document.getElementById('share_customerdiv').style.display ='none';})


3. The simplest, but it will be slightly different on some systems. Flashing.


More from this person...
Message Board
Friends



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn