我在我的网站中使用此代码,我想知道如何为mouseleave函数添加延迟
$target.mouseenter(function(e){
var $tooltip=$("#"+this._tipid)
ddimgtooltip.showbox($, $tooltip, e)
})
$target.mouseleave(function(e){
var $tooltip=$("#"+this._tipid);
setTimeout(function() { ddimgtooltip.hidebox($, $tooltip); }, 4000);
})
$target.mousemove(function(e){
var $tooltip=$("#"+this._tipid)
ddimgtooltip.positiontooltip($, $tooltip, e)
})
if ($tooltip){ //add mouseenter to this tooltip (only if event hasn't already been added)
$tooltip.mouseenter(function(){
ddimgtooltip.hidebox($, $(this))
})
Run Code Online (Sandbox Code Playgroud) jquery ×1