Purpose: asynchronously load the image and stuff it as a source for the background element. Initial data:
var image = document.images[0]; var downloadingImage = new Image(); downloadingImage.onload = function(){ // set sourc as css ?? // = this.src; }; downloadingImage.src = "/images/login/12.JPG"; <style> .login-layout-transparent { background: url(images/loading.gif) 50% no-repeat; </style>
setTimeout(function() { element.style.background = 'url(images/loading.gif) 50% no-repeat;'}, 0);- Mr. Blackimage.onload = ...First, src, hide item, on onload show - Mr. Blackurl(images/loading.gif) 50% no-repeat;it will also continue to try to download it in layers ... - Vyacheslav Potseluykobackground-image, the image will most likely be taken from the cache - Grundy