I intend to have a busy waiting spinner as per shown in this post: How to show loading spinner in jQuery? - since it's the cleanest and easiest to implement:
$('#loadingDiv')
.hide() // hide it initially
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
})
;
and couple it up with the animations from http://www.ajaxload.info/
I have multiple "views" in my page i.e., different parts of my page can be updated/modified with the corresponding ajax calls.
I'd like to "position" this #loadingDiv
close to where the 'action is' so to speak. How should I go about doing it?
Few things that come to mind:
- Have multiple divs all over the place and have them hidden and show them per element as per the corresponding action - seems naive and wasteful
- Have an empty
<span></span>
to 'hold' the#loadingDiv
- show it when something happens in that span. I don't know how to do this though... - Something else??
Basically how best to approach positional busy waiting/signalling rather than have a single global one? Or is the single-global option preferred i.e., To have a "fixed" div, hidden show up on the top/center of the page for every activity?
Just want to know which option most of you have used/preferred to tackle something like that and how do you suggest I go about it...