I have an animated .gif that I want to use as a busy indicator. This busy indicator will be used while some content is loading.
Once loaded, the content will appear within a div. While the content is loading, I want to basically have a semi-transparent layer over the existing content that also shows my animated .GIF
. Currently, I have the following:
<div id="main">
<div id="contentArea">
Loaded content will go here
</div>
<input type="button" value="Load Latest Content" onclick="loadContent();" />
</div>
And the script is:
<script type="text/javascript">
function loadContent() {
// Show busy indicator on semi-transparent layer.
pingWebService();
return false;
}
function pingWebService() {
$.ajax(...);
}
function pingWebServiceComplete() {
// Hide busy indicator
}
</script>
I have my .ajax
call working just fine. I'm just not sure how to do the busy indicator part.
Simple enough, just like musefan said, just hide or show the div containing the image. Here's a contrived example.