How do Preload large images?

Asked

Viewed 597 times

-1

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

$ ("#image"). load (function () {
}
  • You want to make the image only Preload or want to make a Preload to show the page only when that image is ready?

  • show page only when image is ready/loaded...

1 answer

0

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

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

Or

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

If you do not wish your site to appear until it is 100% loaded. you can leave a loading div and the other with all the content of the site within where the site gets hidden.

CSS:

.principal { display: none; }

HTML:

<div class="carregando">Carregando...</div>
<div class="principal"></div>
  • but the page opens and the image is not loaded yet......

Browser other questions tagged

You are not signed in. Login or sign up in order to post.