tags:

views:

896

answers:

5

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

there is some tweek that append to the page (scroller and arrows)and some positionning

Do you have a way, to completely hide everything (just keep the background).. do the things , and show up the finished page ?

+2  A: 

Why not just set the css display property to none, and change it with JS when the document has loaded? If you're using jQuery on your page, it could look like this:

CSS:

#mydiv { display: none; }

JavaScript:

$(document).ready(function() {
    $('#mydiv').show();
});
Tomas Lycken
A: 

This type of question has been asked before. What you're talking about really isn't "preloading"--it's just obstructing the user's view of the page until the page is fully loaded. It doesn't make the page load any faster.

Just put the entire page inside of a container, and use CSS to set that container's display mode to none. Then simply change the container's display mode to anything other than none once the document is ready or the last image has been loaded:

var imgTotal = 10; // total number of images on your page
var imgCount = 0;

$("img").load(function(){
  imgCount++;
  if (imgCount == imgTotal)
    $("#container").show();
}

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

Calvin
A: 

To supplement Calvin's answer, images can be preloaded by adding in this function:

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

Then just telling it which images you want to be loaded:

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

Put that code before the stuff you are loading in, as a courtesy.

karim79
A: 

it not exactly images, but page element that shift the problem...

i have css the body to hidden and the last argument of my jquery is css:visible

work great.. 2 second loading, and everybody show up !

thanks

marc-andre menard
A: 

I would use a DOM ready to set it's display to none, then show it on $(window).load

Otherwise, if they don't have JS enabled, they'll never see a thing!

I've noticed your site is still viewable too without JS, good job!

alex