How do I display a image only after it loads but the rest of the page shows normally? On each page I have something like this <html class"page-name">
and the css is as follows html.page-name { background: url(images/page-name.jpg) no-repeat center center fixed; background-size: cover; }
I tried to do the javascript as $(window).load(function(){ $('html').fadeIn(1500);
});
but this obviously doesn't work because the hole page is blank until the image is loaded. I want the background to be black until the image is loaded and than replace it to the black background. I also tried $(window).load(function(){ $('html').addClass('page-title'); });
where page-title
class has transition effect but also doesn't work.
How do I achieve this, having a black background and replace it with an image after it fully loads ?
Thank you.