maheshforum Posted October 25, 2007 Share Posted October 25, 2007 Hi All, i am entirely new to HTML, and expecting a lot from this forum.Now, i want to display some animation or an image when the page is loading on the Browser window.This makes the User to entertain..Regards,Deepakraj. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 25, 2007 Share Posted October 25, 2007 First, if the page is taking long enough to load that you need to show an animation while it's loading, then you probably want to work on the load time of the page.Second, what do you want to happen while the animation loads? And wouldn't it be better to have all the user's bandwidth be used to download the site content instead of the animation?In order to do something like this you're going to need a fairly large chunk of Javascript that will be the only thing on the page. The Javascript will have to show the animation, load all of the content and place it on the page where it needs to go, and then hide the animation when everything is finished loading. I'm not sure how to use Javascript to check if a given element has been loaded (like an image has been downloaded). Link to comment Share on other sites More sharing options...
Synook Posted October 25, 2007 Share Posted October 25, 2007 If you want a simple cover image/animation, then you can just have divisions that swap <script type="text/javascript"> window.onload = function() { document.getElementById("loading").style.display = "none"; document.getElementById("content").style.display = "block"; }</script><div id="loading"> Loading... <!-- img goes="here" --></div><div id="content"> Welcome to... <!-- content goes="here" --></div> Link to comment Share on other sites More sharing options...
jlhaslip Posted October 26, 2007 Share Posted October 26, 2007 A css method:http://www.jlhaslip.trap17.com/samples/misc/ajax/index.html Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.