Forum Moderators: open
I'm trying to recursively add information into an element via jquery for the life of the page.
Here is what I'm trying to do:
jQuery(document).ready(function(){
function doMessages(){
jQuery("#message").text("Hello");
jQuery("#message").animate({opacity: 1.0}, 3000);
jQuery("#message").empty();
jQuery("#message").text("We're closed");
jQuery("#message").animate({opacity: 1.0}, 3000);
jQuery("#message").empty();
jQuery("#message").text("Come Back Soon");
jQuery("#message").animate({opacity: 1.0}, 3000);
jQuery("#message").empty();
setTimeout( "doMessages();", 5000 );
}
});
I'm sure there's an easier way to do this. And I'm also sure there's a way to get this to actually work. Unfortunately, I haven't gotten anywhere. Anyone have any ideas?
var $j = jQuery.noConflict();
function doMessages() {
$j('#message').fadeIn(3000);
$j('#message').html("This is message number 1 and it has a <a href='http://www.google.com'>link</a>");
$j('#message').fadeOut(3000, function () {
$j('#message').html("This is the second message");
$j('#message').fadeIn(3000);
$j('#message').fadeOut(3000, function () {
$j('#message').html("Message number 3 is right here");
$j('#message').fadeIn(3000);
$j('#message').fadeOut(3000, function () {
$j('#message').html("This right here is message number 4");
$j('#message').fadeIn(3000);
$j('#message').fadeOut(3000, function () {
$j('#message').html("Hello, this is message number 5");
$j('#message').fadeIn(3000);
$j('#message').fadeOut(3000, function () {
setTimeout('doMessages();', 500);
});
});
});
});
});
}
$j(document).ready(function() {
doMessages();
});
Thanks!