jQuery(document).ready(function($) { $('.testimonial li:first-child').show(); function rotate_testimonials(){ var current_item = $('.testimonial li:visible'); var next_item = current_item.next(); if (current_item.is(':last-child')) { next_item = $('.testimonial li:first-child'); } current_item.hide("slide", { direction: "left" }, 450); next_item.delay( 500 ).show("slide", { direction: "right" }, 500); } setInterval(rotate_testimonials, 15000); });