Hey,
I am trying to get jQuery to generate a random background on my site body absed off a number. So I'm trying to get it to generate either main1.jpg or main2.jpg and throw it into the body as a background.
For some reason it is only generating main2.jpg. Here is my code:
$(document).ready(function(){
$("body").css({'background' : 'url(images/main1.jpg)'}).hide();
$("body").css({'background' : 'url(images/main2.jpg)'}).hide();
var randomNum = Math.floor(Math.random()*2); /* Pick random number */
$("body").css({'background' : 'url(images/main:eq(' + randomNum + ').jpg)'}).show(); /* Select div with random number */
});
Thanks, Wade