jQuery. Evento que se para
Buenas!
Nunca había usado jQuery hasta hoy, y estoy intentando hacer que al pasar el ratón sobre una clase de capas haga una animación.
La animación funciona bien si mantengo el ratón sobre la capa, pero si lo pongo y lo quito rápido la primera acción que es un fadeOut, se corta, y se vuelve todo inestable.
¿Cómo puedo deshacer ese fadeOut, o forzar de alguna manera para que el evento acabe del todo? Porque luego en el evento de mouseOut no puedo volver a poner la imagen normal
el elemento html que hace la animacion
<div class="itemIndividual"><div class="number">01</div><div class="miniImgPr"><a href="detalle_v.html"><img class="imgg" src="images/silla1.jpg" /></a></div><div id="jarl3" class="pieItemI"chair</div></div>
y el jquery
var heightCap=30;
$(".itemIndividual").mouseover(function() {
var ppal=this;
$(this).find(".imgg").fadeOut('fast', function() {
$(ppal).find(".imgg").attr("src",$(ppal).find(".imgg").attr("src").replace(".jpg","_c.jpg"));
$(ppal).find(".imgg").fadeIn('fast', function() {
$(ppal).find(".miniImgPr").animate({
'height' : $(this).attr("height")-heightCap+"px"
});
$(ppal).find(".pieItemI").animate({
'height' : heightCap+"px"
});
});
});
}).mouseout(function(){
var ppal=this;
$(ppal).find(".imgg").stop();
$(ppal).find(".pieItemI").stop();
$(ppal).find(".miniImgPr").stop();
$(ppal).find(".imgg").delay(1000).fadeIn('fast', function() {
$(ppal).find(".imgg").fadeOut('fast', function() {
$(ppal).find(".imgg").attr("src",$(ppal).find(".imgg").attr("src").replace("_c.jpg",".jpg"));
$(ppal).find(".imgg").fadeIn('fast', function() {
$(ppal).find(".pieItemI").animate({
'height' : "0px"
});
$(ppal).find(".miniImgPr").animate({
'height' : $(this).attr("width")+"px"
});
});
});
});
});
KingOfSnake
gracias psycho, en el codigo tengo puestos varios stop, pero de forma distinta, probaré como tu dices, a ver que tal. :)
psycho
No me he mirado detalladamente tu codigo, pero muchos conflictos con las animaciones los puedes resolver poniendo un stop() antes de la animacion,
algo así:
$(ppal).find(".miniImgPr").stop().animate({....
$(ppal).find(".miniImgPr").stop().fadeIn(....
A ver si te sirve.