我有下面的js實現了谷歌地圖與循環的自定義標記集。我需要每個標記都有不同的infowindow,因此當您單擊標記時,您將獲得相關的內容。在一分鐘它不會打開信息窗口,並沒有給我一個錯誤控制檯谷歌地圖動態內容在多個自定義標記上的API v3信息窗口
infowindow = new google.maps.InfoWindow();
for(var i=0; i<google_map_item.length; i++)
{
latlon = new google.maps.LatLng(google_map_item[i].lat, google_map_item[i].lon)
bounds.extend(latlon);
var iconcolor = google_map_item[i].iconColor;
marker = new google.maps.Marker({
map: map,
position: latlon,
icon: "https://chart.googleapis.com/chart?chst=d_map_pin_letter_withshadow&chld=" + (i + 1) + "|"+iconcolor+"|000000",
type: 'flat',
icon_color: '#ff0000',
label_color: '#ffffff',
width: '20',
height: '20',
label_size: '11',
clickable: true
});
google.maps.event.addListener(marker, 'click', function() {
//marker.info.open(map, this);
infowindow.setContent(this.latlon);
infowindow.open(map, this);
});
map.fitBounds(bounds);
}
[Google地圖 - 多個標記--1 InfoWindow問題]的可能重複(http://stackoverflow.com/query/ estions/7402667/google-maps-multiple-markers-1-infowindow-problem) – duncan 2012-07-17 12:57:17