I've got this code and it works great to fade in and out one div at a time. I need to fade out two divs at a time, and replace them with the next two.
$(function() {
// Set first div to show
$('.testimonials div:first').show();
// Begin the loop, fade out, find next div, fade that div in, end the process and append back to main div.
setInterval(function() {
$('.testimonials div:first-child').fadeOut().next('div').fadeIn().end().appendTo('.testimonials');
}, 5000);
)};
I tried to improve the script:
The fading is working - it fades out the first two, and fades in the next two. But it never loops!
$(function() {
// Set first div to show
$('.testimonials .quote:lt(2)').show();
// Begin the loop, fade out, find next div, fade that div in, end the process and append back to main div.
setInterval(function() {
$('.testimonials .quote').slice(0,2).fadeOut().nextAll('.quote').slice(3,4).(.fadeIn().end().appendTo('.testimonials');
}, 5000);
)};
The fading is working - it fades out the first two, and fades in the next two. But it never loops!