我需要在标记的每个图之间添加 1 秒的延迟。我想出了以下代码,但无法使其工作。任何想法 ?
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,
});
}