スクリプトに問題があります。誰か助けてもらえますか?
//Add event to google maps click => open marker.infobox
for(var marker in markersWithArray){
var lastInfoWindow; //Get lastInfoWindow for close google maps infowindow
var markerI = markersWithArray[marker]; //Get marker from loop
var infoWindow = markerI.infoWindow; //get infoWindow from marker, work prefectly
console.log(infoWindow) // => all time good, object with
// info box. All time unique id and content.
google.maps.event.addListener(markerI, 'click', function() {
console.log(infoWindow); //Problem here, object too, but id and content have
//a last value what recorded on top (console.log)
//last value of cycle
if(lastInfoWindow)
lastInfoWindow.close();
infoWindow.open(map, this);
lastInfoWindow = infoWindow;
});
}
イベント「google.maps.event.addListener」までのサイクルで値を取得する方法を教えてもらえますか?どうも :)。