Сергей Петров Сергей Петров - 3 months ago 39
Javascript Question

Google Maps API (JS V3) - progressive loading

There is a possibility to load markers gradually? I have many markers and map always waits until there all add up, and then suddenly appears. I want to add markers gradually.

For example:

map.addMarker({});
sleep(500);
map.addMarker({});
sleep(500);
map.addMarker({});


I have to wait until 1000 ms and then the markers appear. I believe You understand what I mean.

Thanks!

Answer
Hi you can use set interval for this like below:-     

addressArray.forEach(function(element, index, array){
        delay += 800;       
        setTimeout(function() {
        //Your code here

        }, delay);

      });