Nohana Posted December 15, 2007 Share Posted December 15, 2007 How can I create a "Now Loading..." screen, similar to those you see in flash/java games using JS? I'm designing a small modest game, and would like to have all images preloaded before the game begins. ^_~ Link to comment Share on other sites More sharing options...
Synook Posted December 16, 2007 Share Posted December 16, 2007 Well, you could have two divisions, one to show while loading and the other to show after it has loaded. <script type="text/javascript">window.onload = function() {document.getElementById('loading').style.display = "none";document.getElementById('content').style.display = "block";}</script><!-- ... ... --><div id="loading">Now Loading...</div><div id="content">All your content goes here</div> Link to comment Share on other sites More sharing options...
Nohana Posted December 16, 2007 Author Share Posted December 16, 2007 Thanks for your reply, but what I want to know is how to create the trigger for displaying both screens. =PHow can I tell the browser all images have finished loading so the 'content' <div> can become visible?Does the window.load part do this? Link to comment Share on other sites More sharing options...
Sniffy Posted December 17, 2007 Share Posted December 17, 2007 window.onLoad() is after the page is loaded.Make sure that all your content is not displayed (via the stylesheet or whatever method you choose)Make sure only the id "loading" is the only thing that is displayed (do this via stylesheet or....)Add the code that Synook gave you and you're done... I think. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.