Forum Moderators: not2easy

Message Too Old, No Replies

CSS Preloader

I need to cover up content until it is all loaded

         

j2theoey

9:08 pm on Jan 19, 2006 (gmt 0)

10+ Year Member



Ok ive been looking for a while and everything seems to confuse me.

You can look at what i have here.... ooops... its really simple at this point so theres not alot for anyone to dig through in the code.

I know it might require some javascript, but i felt it was more appropriate to place the post here. If anyone can help it would be appreciated.

Thanks,
Joey

[edited by: SuzyUK at 9:42 am (utc) on Jan. 24, 2006]
[edit reason] sorry no URLs : see TOS #13 [WebmasterWorld.com] [/edit]

SuzyUK

9:50 am on Jan 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Joey and Welcome to WebmasterWorld

perhaps this is more of a javascript question, I would think some sort of timer function to delay "content", but I'm a copy/paste javascripter so what would I know ;)

CSS isn't a scripting language and therefore cannot build a preloader. It can be used to simulate a preload for images whereby the page actually loads the images (like hover sates) into the page but the CSS hides them until they are required.

Have you more info on what type of content (e.g. will it be a whole div containing text? or is it images) you require to be delayed, if it turns out to be a js question then DrDoc may be along later and we can move it to the right place for you.

Suzy

Arno_Adams

12:20 pm on Jan 25, 2006 (gmt 0)

10+ Year Member



Hi Joey,

Maybe this will help you:
img { background: url(loading.gif) no-repeat 50% 50%; }

Use an animated GIF that looks like a preloader.

Thank maratz[dot]com for this idea.

HTH, AA

DrDoc

3:55 pm on Jan 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think SuzyUK is absolutely right -- this is more of a JavaScript question.
What you probably want to do is something like:

1) Create a wrapper which holds all the page content
...
<body>
<div id="wrapper">
...
</div>
</body>
...

2) To ensure that content doesn't remain hidden if JavaScript is turned off, hide it using JavaScript to begin with. Then unhide it once the page is loaded, using a body onload call
...
</style>
<script type="text/javascript">
function unHide() {
document.getElementById('wrapper').style.display = "block";
}
document.write("<style type=\"text/css\"> #wrapper { display: none; } </style>");
</script>
</head>
<body onload="unHide()">
...