使用不同鼠标输入和鼠标离开的悬停Intent插件

时间:2012-04-25 10:10:16

标签: jquery hoverintent

我正在使用Hover indent插件,这只有一个功能可以结合鼠标悬停和鼠标离开

代码1:

$("#tab").hoverIntent({
over: show, 
timeout: 20, 
out: hide
});
function show(){
$(".part").show();
}
function hide(){
$(".part").hide();
}

需要为.part写鼠标离开功能,所以这样做了

代码2:

$("#tab").hoverIntent({
over: show, 
timeout: 20, 
out: hide
});
function show(){
$(".part").show();
}
$(".part").hoverIntent({
over: show, 
timeout: 20, 
out: hide
});
function hide(){
$(".part").show();
}    

但似乎错误......如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您无法移除任何功能,因为在hoverintent()中使用了show()ehide()两个函数,请将此函数设为空白

$("#tab").hoverIntent({
     over: show, 
     timeout: 20, 
     out: hide
});
function show(){
   $(".part").show();
}
function hide(){
}

$(".part").hoverIntent({
   over: show1, 
   timeout: 20, 
   out: hide1
});
function show1(){
}
function hide1(){
    $(".part").hide();
}

你必须使用不同的函数名,每个show(),hide(),show1(),hide1()都是这样的......试试这个