How to preload large images? [duplicate]

-1

I have a background of 2mb to do preload and I do not know how to do it ... I already tried the basics, for example:

$ ("#image"). load (function () {
}
    
asked by anonymous 10.04.2014 / 21:42

1 answer

0

I understand that you want to show your site only when all images are loaded. So just use:

$(window).load(function() { $('.principal').show(); })

Or

$('body').load(function() { $('.principal').show(); })

If you do not want your site to appear until it is 100% loaded. you can leave a loading div and another one with all the content of the site inside where the one of the site starts hidden.

CSS:

.principal { display: none; }

HTML:

<div class="carregando">Carregando...</div>
<div class="principal"></div>
    
10.04.2014 / 22:04