Page loading panel before loading the whole page?

Possible duplicate:
Loading a line when running the script

Hi, I have a page with a large number of images, and I was wondering if there is a way to postpone the display of these images until the whole page is loaded, for example, as a loading bar, and using jQuery? Any help would be greatly appreciated.

+5
source share
4 answers

Of course, this is very easy to do with jQuery. Use the event window.loadto determine when all images load, then show the content:

HTML

<html>
<body>
   <div id="loading"></div>

   <div id="container">
       <img src="http://www.playirishlottery.co.uk/wp-content/uploads/image-2.jpg"/>
   </div>

</body>
</html>

JQuery

$(window).load(function() {
    //show();
});


function show() {
    $('#loading').hide();
    $('#container').fadeIn();
};

setTimeout(show, 3000);

setTimeout, . show() .load

Fiddle: http://jsfiddle.net/xM6v9/

+10

- , , jQuery : http://jsfiddle.net/ErickPetru/g7D8e/.

: div display: none, div /gif.

JS </body> a <script>. , JS .

+3

, /. - . .

, src. src - . jquery, src , . .

http://staticvoid.info/imageLoader/

. ( , , )

+1
source

Just use window.onload

It starts when everything on the page loads. No jQuery required.

0
source

All Articles