I've seen a lot of different background switching based upon link classes, however I just want a simple background switcher on any page load (no cookies) and not link dependent.
is there a simple method for this? jquery?
I've seen a lot of different background switching based upon link classes, however I just want a simple background switcher on any page load (no cookies) and not link dependent.
is there a simple method for this? jquery?
Are looking for javascript timers?
Example:
setInterval("switchBackground()", 1000);
function switchBackground( )
{
$("body").css("backgroundImage", "xxx");
}
I hope this help!
Edit:
To generate random background at start:
$(document).ready(function() {
//This will be random from bg1.jpg to bg10.jpg
$("body").css("backgroundImage", "/images/bg"+GenerateNumber(10)+".jpg");
//1 to max
function GenerateNumber(max) {
return Math.floor(Math.random()*max) + 1;
}
});