Hidden jquery preload

Here is my page http://equipe94.com/2009e.html

there are several tweeks that are added to the page (scroller and arrows) and some positioning

Do you have a way to completely hide everything (just keep the background) .. do things and display finished pages?

0
jquery preload
Apr 21 '09 at 22:55
source share
5 answers

Why not just set the css display property to none and change it with JS when loading the document? If you use jQuery on your page, it might look like this:

CSS

 #mydiv { display: none; } 

JavaScript:

 $(document).ready(function() { $('#mydiv').show(); }); 
+3
Apr 21 '09 at 23:08
source share
— -

To complement Calvin's answer, images can be preloaded by adding to this function:

 $.preloadImages = function() { for(var i = 0; i<arguments.length; i++) { $("<img>").attr("src", arguments[i]); } } 

Then just indicate which images you want to upload:

 $.preloadImages("image1.gif", "/path/to/blah.png", "some/other.jpg"); 

Put this code before what you download as a courtesy.

+2
Apr 21 '09 at 23:18
source share

This question has been asked before. What you're talking about is not "preloading" - it just prevents the user from viewing the page until the page is fully loaded. This does not speed up page loading.

Just put the whole page inside the container and use CSS to set the container's display mode to none . Then just change the display mode of the container to everything except none when the document is ready or the last image is loaded:

 var imgTotal = 10; // total number of images on your page var imgCount = 0; $("img").load(function(){ imgCount++; if (imgCount == imgTotal) $("#container").show(); } 

However, given that your page loads in less than a second in my browser, I really don't see any point in this.

0
Apr 21 '09 at 23:12
source share

these are not exactly images, but a page element that change the problem ...

I have a css body to hide and the last argument of my jquery is css: visible

works great .. a 2 second download and everyone appears!

thank

0
Apr 21 '09 at 23:31
source share

I would use the DOM to set the display to none, and then show it to $ (window) .load

Otherwise, if they do not have JS, they will never notice anything!

I noticed that your site is still viewable without JS, good work!

0
Apr 21 '09 at 23:53
source share



All Articles