everyone,I would like to use for-loop to set infowindows on my map. And I want the infowindow appear on the coordinates that I entered in the array,but it's doesn't work. Above are some parts of my codes,but I don't know what's wrong with my codes?
var infoposition = [
{lat:24.141328, lng:120.668040},
{lat:24.145371, lng:120.671323},
{lat:24.141720, lng:120.672332},
{lat:24.142141, lng:120.671774}
];
var contentspeed = [
'40km/h',
'42km/h',
'35km/h',
'40km/h'
];
for (var i=0;i<(infoposition.length)-1;i++) {
var infowindow = new google.maps.InfoWindow({
content: contentspeed[i],
position: infoposition[i],
maxWidth:50,
pixelOffset: new google.maps.Size(-35, 100)
});
}
infowindow.open(map,marker);
Comments
Post a Comment