Hi All,
I'm trying to put together a "fade in", "fade out" segment for user comments on a website. The array of comments with key=>value (memberName=>comment) comes from php. I'm looping through using jQuery like so;
$(document).ready(function(){
function swap() {
<?php foreach ($memberTestimonials as $member=>$testimonial) : ?>
$('#testimonialMessage').fadeIn(5000);
$('#testimonialMessage').html("<p><?php echo $testimonial; ?></p>");
$('#testimonialMessage').fadeOut(5000);
<?php endforeach; ?>
swap();
}
swap();
});
The array $memberTestimonials is;
array (size=3)
'Michael Burrells' => string 'This was a lot of fun!' (length=22)
'Homer Simpson' => string 'Mmmmmm. Donuts.' (length=15)
'Albert Einstein' => string 'E=MC^2' (length=6)
The only issue is, only the E=MC^2 record is showing (repeatedly). It shows three times without recursion.
Does anyone have any ideas why this might be happening?
Thanks for any help offered.