J'ai versé sur le code suivant, en essayant de faire fonctionner le plugin hoverIntent, en vain. C'est très basique (si vous avez des idées de consolidation, n'hésitez pas) - .hover fonctionne bien, mais .hoverIntent = pas de dés.hoverIntent problème de base?
Fondamentalement, je veux juste un img grand pour changer quand un utilisateur souris sur une vignette, mais pour éviter le farfadet, il suffit d'attendre quelques minutes avant de tirer.
Mon jQuery (MISE À JOUR ET DE TRAVAIL SURTOUT) Code:
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 J'utilise hoverintent et didn'run un problème quelconque, vous pouvez factoriser votre code pour prendre plusieurs classes dans une fonction de vol stationnaire – kobe
@gov - vous voulez dire utilisé hoverIntent sur l'exemple ci-dessus et cela a fonctionné? Hmmm ... J'ai vérifié mon chemin environ un million de fois, et c'est correct. Quelle version de jQuery utilisez-vous? – collin
@collin, non j'ai utilisé le plugin hoverintent dans mes projets, ça marche plutôt bien, la version jquery est 1.4. – kobe