1 ページに 2 つのマップがあります。マップは正常にロードされますが、マップ上の両方のマーカーがトリガーされ、最後の情報ウィンドウのみが表示されます。そうしないと質問を送信できないので、私はbla blaを書き続けています:-)
コードは次のとおりです。
var places = {
place1 : {
long : 0.0,
lat : 0.0,
address : 'Address...'
},
place2 : {
long : 0.0,
lat : 0.0,
address : 'Address...'
}
};
for( var i in places ) {
mapPositions[i] = new google.maps.LatLng( places[i].long, places[i].lat ),
myOptions[i] = {
zoom: 15,
center: mapPositions[i],
disableDefaultUI: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
$maps[i] = new google.maps.Map( document.getElementById( i + "_map_canvas" ), myOptions[i] );
var title = 'Company ' + i;
LatLngs[i] = new google.maps.LatLng( places[i].long, places[i].lat );
markers[i] = new google.maps.Marker({
position: $maps[i].getCenter(),
map: $maps[i],
title: title,
location: places[i]
});
infowindows[i] = new google.maps.InfoWindow({
content: '<div class="infoWindow">' +
markers[i].title + ' - ' + markers[i].location.address + '<br/>' +
'</div>'
});
google.maps.event.addListener( markers[i], 'click', function() {
infowindows[i].open( $maps[i], markers[i] );
});
}
誰が何がうまくいかないのか見ることができますか?