[英]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);
}
}
有沒有辦法在每個標記之間進行延遲? 謝謝
您可以在創建一個標記和下一個標記之間設置超時,如下所示(下面的示例暫停 500 毫秒):
setTimeout(function(){}, '500');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.