Created
July 24, 2013 15:30
-
-
Save alanerzhao/6071648 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var qz = { | |
/* | |
@param currentObj {Object} 当前对象 * jq obj | |
@param showObj {Object} 显示对象 * jq obj | |
@param speed {Number} 延迟时间 * not 0 | |
@param callBack {Function} 关闭层后回调 | |
@param current {Object} 当前回调对象 | |
example: | |
qz.hoverdeLay($(".btn"),$(".tips"),200,function (current){ | |
console.log(current.show()); | |
}) | |
*/ | |
hoverdeLay : function (currentObj, showObj, speed,callBack) { | |
var def = speed || 300, | |
timer = null; | |
currentObj.hover(function() { | |
clearTimeout(timer); | |
showObj.show(); | |
},function() { | |
timer = setTimeout(function() { | |
showObj.hide() | |
},def); | |
}); | |
showObj.hover(function() { | |
clearTimeout(timer); | |
},function() { | |
var _this = $(this); | |
timer = setTimeout(function() { | |
_this.hide(); | |
if(typeof callBack !== "undefined"){ | |
//回调传入当前对象 | |
callBack(_this); | |
} | |
},def); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment