I'm using this code myself (emplying the jQuery progressBar plugin):
$j.getJSON(request,
function(data, status){
function doAdd(items) {
addProperty(items[item_n++]); // To map
progress(item_n,item_total);
if (item_n < item_total)
setTimeout(callDoAdd(items),100);
else {
$j("div#progress").remove();
}
}
function callDoAdd(items) {
return function() {
doAdd(items);
}
}
item_total = data.markers.length;
item_n = 0;
if (item_total > 1) {
$j("div#map:not(:has('div#progress'))").append("<div
class='noprint' id='progress'>Loading... <a id='cancel' href='#'>
[Quit]</a></div>");
$j("a#cancel").click(
function() {
cancel = 1;
}
);
$j("div#progress").progressBar({
boxImage:
'/images/progressbar.gif',
barImage:
'/images/progressbg_green.gif'
});
}
setTimeout(callDoAdd(data.markers),100);
}
);
function progress(cur,total) {
$j("div#progress").progressBar(Math.floor(100 * (cur/total)));
}
The doAdd() and callDoAdd() functions faciitate passing a JASON array
to the function that setTimeout calls (you can't directly do that
because the function will execute immediately instead of after the
timer expiration). My progress bar is displayed in <div#progress>,
which I create and destroy as needed. It is positioned with CSS to
'float' over the middle of the map.
The single-threadedness of javascript necessitates having a timer to
interrupt the thread so the progress bar can be updated in between
each marker being generated. I found doing this for each marker to be
fine for my purposes but perhaps doing them 10 or 25 at a time might
be preferable to someone else.
On Nov 18, 3:28 pm, Rossko <[EMAIL PROTECTED]> wrote:
> You might like to search this group for 'progress bar'
> It's not an easy thing to implement
> An example -
>
> http://groups.google.com/group/Google-Maps-API/browse_thread/thread/d...
>
> cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---