I've seem to run into an issue, i saw a lot of implementations of the infobox but cant seem to figure out how to insert another piece of code onto a marker. I'm quite unexperienced with javascript so i can't seem to figure it out.
When i go to the maps it shows all the markers but only selects the piece of code that is the last in the array,
code :
function updateMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: locationarray[0]
});
var markernumber = new Array();
for (var i = 0; i < 99; i++) {
markernumber[i] = new google.maps.Marker({
position: locationarray[i],
map: map
});
console.log('in loop:' + i);
google.maps.event.addListener(markernumber[i], 'click', function() {
console.log('in click:' + i);
openInNewTab(contentString[i]);
});
}
document.getElementById('loader').style = "opacity: 0;";
}
contentstring[i] is working fine, so it's nothing outside of this function.