function slide()
{
if($('.current').is(':last-child')){
$('.current').removeClass('.current');
$('#imgholder').first().addClass('.current');
$('#imgholder').animate({left: '3920px'});
}
else{
$nxt=$(".current");
$(".current").removeClass("current");
$nxt.next().addClass("current");
$('#imgholder').animate({left: '-=980'},{duration: 'slow', easing: 'easeOutBounce' });
}
}
var loop_handle= setTimeout("slide()",'3000');
I have put this code in header section and the setTimeout runs only once.
See Question&Answers more detail:os