我需要在每個標記之間添加1秒的延遲。我想出了下面的代碼,但不能使它工作。任何想法 ?在Google地圖標記的地塊之間添加延遲
var latlng = new google.maps.LatLng(43,2.34);
var myOptions = {
zoom: 7,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
for (var i=0, len=json.length; i<len; i++){
obj = json[i];
// Get lat/long and put them on the map
var lat = obj.latitude;
var long = obj.longitude;
display_marker(map, lat, long);
}
display_marker = function(map, lat, long){
setTimeout(function(){}, 1000);
var marker = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(lat,long),
title: "Latitude: " + lat + "\nLongitude: " + long,
});
}