Loading gif white download - agree, this
How can I create a “Please Wait, Loading…” animation using jQuery?
You could do this various different ways. It could be a subtle as a small status on the page saying "Loading...", or as loud as an entire element graying out the page while the new data is loading. The approach I'm taking below will show you how to accomplish both methods.
The Setup
Let's start by getting us a nice "loading" animation from http://ajaxload.info I'll be using
Let's create an element that we can show/hide anytime we're making an ajax request:
The CSS
Next let's give it some flair:
And finally, the jQuery
Alright, on to the jQuery. This next part is actually really simple:
That's it! We're attaching some events to the body element anytime the or events are fired. When an ajax event starts, we add the "loading" class to the body. and when events are done, we remove the "loading" class from the body.
See it in action: http://jsfiddle.net/VpDUG/4952/
-
-
-