Please note that in this implementation, users without javascript enabled will not be able to see your comment. The #content and #loading parts should be respectively ON and OFF in your css stylesheet. javascript should control the entire sequence and not only the end of it.
The way i did it is by creating a show / hide functions taking care of creating the loading div html code, and toggling the visibility of the two, and then attaching to each A and BUTTON element the behaviour to launch the function. -----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jean Nascimento Sent: vendredi 25 mai 2007 8:20 To: jquery-en@googlegroups.com Subject: [jQuery] Re: Loading before teh DOM is ready Thankssssssssss! I used this for test =D <html> <head> <title>My page</title> <style type='text/css'> #content { display: none } #loading { background-color: #000066; color: #FFFFFF; display: block; font-family: Verdana, Helvetica, sans-serif; font-size: 0.95em; font-weight: bold; padding: 3px 3px; width: 200px; } </style> <script type="text/javascript" src="jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready( function() { $("#loading").hide(); $("#content").show(); }); </script> </head> <body> <div id="loading">Loading...</div> <div id="content"> .. content here <? for($i=0;$i<100000;$i++){ echo $i." ushohdoy3809yh!<br />"; } ?> </div> </body> </html> On 5/25/07, Sam Collett <[EMAIL PROTECTED]> wrote: > > How about: > > <html> > <head> > <title>My page</title> > <script type="text/javascript"> > document.write("<style type='text/css'>#content { display: none } > #loading { display: block } <\/style>"); $( function() { > $("#loading").hide(); > $("#content").show(); > }); > </script> > </head> > <body> > <div id="loading">Loading...</div> > <div id="content"> > .. content here > </div> > </body> > </html> > > On May 24, 7:45 pm, "Jean Nascimento" <[EMAIL PROTECTED]> wrote: > > I´ve tried add some code before the $(document).ready but its dont > > work, so i wanna know how the best way to show some Loading div > > before all docuemnt be ready? > > > > -- > > > > []´s Jeanwww.suissa.info > > > > Ethereal Agencywww.etherealagency.com > > -- []´s Jean www.suissa.info Ethereal Agency www.etherealagency.com Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.467 / Base de données virus: 269.8.0/817 - Date: 24/05/2007 16:01