I have several images that are being animated (faded out and in) that I want to hide and show. Using hide()
and show()
doesn't work as they just fade themselves back in. I thought I could detach()
them and then appendTo()
them, which works, but the animation doesn't continue after they're reattached. Some code follows:
Animation
function loading() {
$('#load0').delay(300).fadeIn(200);
$('#load1').delay(500).fadeIn(200);
$('#load2').delay(700).fadeIn(200);
$('#load0').delay(500).fadeOut(75);
$('#load1').delay(700).fadeOut(75);
$('#load2').delay(900).fadeOut(75, loading);
}
loading();
Detachment and Appending
var load;
$('#slideshow').on('cycle-before', function() {
load = $('.load').detach();
});
$('#slideshow').on('cycle-after', function() {
load.appendTo("#main");
});
How can I hide and re-show these elements?