Display slideshow (?) using content from external file.
Hello.
I'm using this code to display random quote from external file on my main page.
-
$(function() {
$('div#quotesContainer').load('quotes.html',function(){
var $quotes = $(this).find('div.quote');
var n = $quotes.length;
var random = Math.floor( Math.random()*n );
$quotes.hide().eq(random).fadeIn();
});
});
What it does, obviously, is displaying random div with a class of "quote" from the file quotes.html inside the #quotesContainer div (with a little fadeIn effect
) in my main page.
Since I'm a total jQuery/JS newbie still, I was wondering how to change this bunch of code so that it will display a random quote for, let's say, 30 seconds then load another random quote without need to reload the page.
Or maybe even fancier/simpler - display each quote for 30 sec and then fade to the next one, in a loop or something? Something like a slideshow effect or similar. Like I said, I'm still a newbie so any help would be much appreciated
Thanks in advance!
Justine