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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.