How To: Create a Simple Visual “Loading” Effect
If you’re using a language that provides a buffer (ASP for instance), make sure you turn the buffer off first, or this won’t have any effect. (eg. Response.Buffer = False)
Example (See it in action):
1 2 3 4 5 6 7 | <p id="loading_msg"><img src="http://img520.imageshack.us/img520/4950/loadingvp7.gif" alt="" style="vertical-align: middle;" /> Loading...</p> <?php // Code that takes forever here, could of course be any language sleep(5); // Only for demonstration ?> <style type="text/css">#loading_msg { display: none; }</style> Woohoo, five seconds passed. |
![[del.icio.us]](http://www.randomtools.net/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.randomtools.net/wp-content/plugins/bookmarkify/digg.png)
![[Facebook]](http://www.randomtools.net/wp-content/plugins/bookmarkify/facebook.png)
![[Google]](http://www.randomtools.net/wp-content/plugins/bookmarkify/google.png)
![[MySpace]](http://www.randomtools.net/wp-content/plugins/bookmarkify/myspace.png)
![[Reddit]](http://www.randomtools.net/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](http://www.randomtools.net/wp-content/plugins/bookmarkify/slashdot.png)
![[StumbleUpon]](http://www.randomtools.net/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.randomtools.net/wp-content/plugins/bookmarkify/technorati.png)
![[Windows Live]](http://www.randomtools.net/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.randomtools.net/wp-content/plugins/bookmarkify/yahoo.png)