I'm placing a marker on google map from the array values and multiple push pin markers will be shown on the map. I want to specify the delay time for each marker shown on the map. How can I do that?
var map = new google.maps.Map(document.getElementById('map-canvas'), {
zoom: 5,
center: new google.maps.LatLng(21.9200,77.9000),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var image = 'images/pushpins/set1.png';
var marker, i;
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
function placeMarkers(){
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
window.setInterval(5000);
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: image
});
}
Here i am placing the marker, using loop with set interval, but its not working.
function placeMarkers(){
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
window.setInterval(5000);
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: image
});
I have added the set interval(), but still the markers appear all at a time, i want it to come one after the other with a delay time.
you should try timeout here's how it's works
Here's a quick demo.