0
我一直在傾倒下面的代碼,試圖讓hoverIntent插件工作,無濟於事。 這是非常基本的東西(如果你有任何整合的想法,請放心) - .hover工作正常,但.hoverIntent =沒有骰子。hoverIntent基本問題?
基本上,我只是想要一個大的img改變,當一個用戶鼠標懸停在縮略圖上,但爲了避免不小心,在發射之前等待幾個。
我的jQuery(更新MOSTLY工作),代碼:
function makeShow1(){
$("#some-div img").hide();
$(".uno").show();
}
function makeShow2(){
$("#some-div img").hide();
$(".dos").show();
}
function makeShow3(){
$("#some-div img").hide();
$(".tres").show();
}
function makeShow4(){
$("#some-div img").hide();
$(".quattro").show();
}
function makeShow5(){
$("#some-div img").hide();
$(".cinco").show();
}
function passOut() {
$.(this).stop();
}
$(document).ready(function() {
$(".switch1").hoverIntent({
over: makeShow1,
timeout: 500,
interval: 300,
out: passOut
});
$(".switch2").hoverIntent({
over: makeShow2,
timeout: 500,
interval: 300,
out: passOut
})
$(".switch3").hoverIntent({
over: makeShow3,
timeout: 500,
interval: 300,
out: passOut
})
$(".switch4").hoverIntent({
over: makeShow4,
timeout: 500,
interval: 300,
out: passOut
})
$(".switch5").hoverIntent({
over: makeShow5,
timeout: 500,
interval: 300,
out: passOut
})
});
</script>
@collin我使用hoverintent和didn'run遇到任何問題,可以重構代碼,以多個類在一個懸停功能 – kobe 2010-12-03 18:08:52
@gov - 你的意思是使用hoverIntent在上面的例子中,它的工作?嗯...我已經檢查過我的路了大約一百萬次,這是正確的。你運行的是什麼版本的jQuery? – collin 2010-12-03 18:11:04