onmouseout 发现它的触发太敏感,当经过层内文字链时,即触发onmousetout事件,功能不能正常显示,经过一番搜索,整理出来,供大家参考。
1、
复制代码 代码如下:
faddsf
2、
复制代码 代码如下:
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;
}
};
//调用
leavefun('share_customerdiv').mouseleave(function(){document.getelementbyid('share_customerdiv').style.display ='none';})
3、最简单,但在部分系统上会有轻微闪烁。
复制代码 代码如下:
更多此人的...
留言板
好友