I load my pages dynamically with php.
Only the information in my content div changes.
I have a script that changes the background image on refresh.
but it gives a white flash when you navigate through the site.
var totalCount = 6;
function ChangeBackground()
{
var num = Math.ceil( Math.random() * totalCount );
document.body.background = 'background/test/'+num+'.jpg';
}
How can i prevent that?
I’m assuming this is an issue of the browser loading the image, and trying to display it before it’s fully downloaded.
Have a look at this article for information on pre-loading images before displaying them.