JavaScript Preloader version 2.0.3 XHTML
Here is a "preloader" which will load your pages before displaying the content. This "preloader" displays an image animated gif while loading a white background.
Here is an example of what it can give you advice I do not use this script if you used the "CSS Reset. And do not tag "DIV" General "CSS" position using the "on" all
Here is the Javascript code on this preloader.
/ / You can change the velocity (speed) (1 == very fast) / / You can change the quality of the transition (1 == best) / / As the transition is, the better the speed slowed down and must be increased ; var speed = 10; ; var transition = 10; / / Size of preloader animated GIF ; GIFpreloadLargeur var = 20; ; GIFpreloadHauteur var = 20; ; var timer = 0; ; var opacity = 100; opacity function () ( opacity = opacity - transition; ( "preloader" ) . style ; var object = document. getElementById ("preloader"). stylus; opaciT / 100 ) ; object. opacity = (opacity / 100); opaciT / 100 ) ; object. MozOpacity = (opacity / 100); opaciT / 100 ) ; object. KhtmlOpacity = (opacity / 100); + opaciT + ")" ; object. filter = "alpha (opacity =" + opacity + ")"; opaciT <= 0 ) if (opacity <= 0) ( "preloader" ) . style . visibility = "hidden" ; document. getElementById ("preloader"). style. visibility = "hidden"; ; clearInterval (timer); ) ) function preload () ( document. getElementById ) if (document. getElementById) ( "preloadIMG" ) . style . visibility = "hidden" ; document. getElementById ("preloadIMG"). style. visibility = "hidden"; ,speed ) ; timer = setInterval ("opacity ()", speed); ) else ( document. layers ) if (document. layers) ( = "hidden" ; document. preloadIMG. visibility = "hidden"; ,speed ) ; timer = setInterval ("opacity ()", speed); ) else ( . style . visibility = "hidden" ; document. all. preloadIMG. style. visibility = "hidden"; ,speed ) ; timer = setInterval ("opacity ()", speed); ) ) ) / / GENERATE THE CSS FOR PRELOAD var myCSS; myCSS = " ; <style type= \" text/css \"> "; myCSS + = "html, body (height: auto; margin: 0px; padding: 0px;)"; myCSS + = "# preloader ("; myCSS + = "position: fixed;" myCSS + = "background-color: white;" myCSS + = "width: 100%;" myCSS + = "height: 100%;" myCSS + = "display: block;" myCSS + = 'z-index: 100000; " myCSS + = ")"; myCSS + = "# (preloadIMG"; myCSS + = "position: absolute;" myCSS + = "left: 50%;" ; myCSS + = "width:" + GIFpreloadLargeur + "px;" ; myCSS + = "height:" + GIFpreloadHauteur + "px;" GIFpreloadLargeur / 2 ) + "px;" ; myCSS + = "margin-left: -" + (GIFpreloadLargeur / 2) + "px;" myCSS + = "top: 150px;" myCSS + = ")"; myCSS + = "</ style> " / / WRITING OF CSS ( myCSS ) ; window. document. write (myCSS); / / IMPLEMENTATION ( ) { preload ( ) ; } window. onload = function () (preload ();)
Now, please insert this code after the BODY tag. Take note that the "image of preload must be placed on your server and the source must be changed depending on the" edroit or is your image.
<div id="preloader"> <div id="preloadIMG"> <img src="loading.gif" alt="" /> </ div> </ Div>
Well, now you have a preloader chic for your web pages heavy.
Tags: Images , Javascript , preloader , XHTML






April 20, 2008 at 12:32
Ê except that I have one that appears. If I can resolve this issue I care, otherwise ...
in any case thank you for this very nice script
May 20, 2008 at 11:53
I'll test genial
May 26, 2008 at 9:02
Very good initiative that preloader. This is what I need for my site, except for one thing. It prevents the loading of Flash animations. Would there be a simple solution to this problem?
June 13, 2008 at 1:24
Super Code by cons, I have a concern, after the establishment of a code that works perfectly, my menus and function button more n'on "rollover" in IE, while in opera, there is no problem
But thank you even
September 3, 2008 at 18:22
hello, thank you for this script is great.
but how can we modify it to load more images that are not necessarily located on the page?
September 11, 2008 at 19:08
Super! Works very well .. but I also put it on the forefinger of my web page that refers to my forum, how can I integrate it to index my web page without a page to all my forum.
I just want it to preload the forum from the index welcome .. esse possible.
January 6, 2009 at 13:09
Really hats off to this bit of code really well prepared. But I have a small problem.
Here is the preload starts up properly with the little animated gif only when the page loaded the preload does not disappear. It remains displayed.
But where it may come? I can not find the solution ...
June 4, 2009 at 3:50
Hello
Thank you for this script, I was looking for a long time. Congratulations it works very well. Bonne continuation.
June 10, 2009 at 5:07
thank you for this code!
walk impeccable home!
October 10, 2009 at 4:33
Hello
I can not upload my whole site please do summit?
October 11, 2009 at 19:52
Should see the code, is what you can give me a link development?
December 29, 2009 at 11:36
Hello everyone
I do not understand or fau put the first code c is in the HEAD???
thank you
December 29, 2009 at 19:30
Yes you should put the code in head or in an external Javascript file loader that will be in the head.