Google maps js api v3: add delay to markers
function setMarkers(map, markers) {
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < markers.length; i++) {
var siteLatLng = new google.maps.LatLng(markers[i][2], markers[i][3]);
var marker = new google.maps.Marker({
position: siteLatLng,
map: map,
animation: google.maps.Animation.DROP,
title: markers[i][1],
html: markers[i][0]
});
google.maps.event.addListener(marker, "click", function () {
$('.imglink').attr('href', 'img/' + this.html);
$('.imglink').click();开发者_如何转开发
});
bounds.extend(siteLatLng);
map.fitBounds(bounds);
}
}
Is there any way to make a delay between each marker? Thanks
You can set a timeout between the creation of one marker and the next like so (the example below makes a 500ms pause):
setTimeout(function(){}, '500');
精彩评论