views:

10158

answers:

6

I have a page being loaded with jQuery. The initial load includes 100 records with 6 icons per record. Needless to say, it takes a few seconds to load and I want to give the user a "loading" prompt/animation.

Any ideas?

A: 

You could display a div with an animated GIF image as a loading prompt. That's the way I've done it in the past.

DMKing
A: 

Any time I've needed something like this I replace the element that will be loaded with a simple, centered, animated gif of some sort that says "Loading, please wait" or a similar message. If it's only going to be a few seconds a progress indicator is probably overkill, but a simple animation gives most people the assurance that, yes, your site is still working.

Toji
+6  A: 

http://www.ajaxload.info/ is a great resource for generating animated GIFs for this sort of thing.

Once you've got your animation, render it as part of the page; fire the jQuery load mechanism on the animation's onload() event (so you're certain the animation has loaded first), and use a callback at the end of your loading sequence to disable/hide the animated GIF.

Dylan Beattie
that's the one, thanks a ton, that ajaxload.info is an extra bonus. Thanks again
Gene R
+3  A: 

Matt Berseth has a nice jQuery-based way of doing this.

Jason Bunting
A: 

You may want to set up a global ajax event to show/hide the loading icon. Have a look at: http://docs.jquery.com/Ajax_Events

Sugendran
A: 

Another ressource for loading images : http://www.loadinfo.net/

unknownclubber