I have 3 Points in my Map, France, Paris and Greenland.
Popup is opening only on paris, not on others
Here is my code:
var myCenter=new google.maps.LatLng(51.508742,-0.120850);
function initialize()
{
var mapProp = {
center:myCenter,
zoom:5,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
var arr = [{id:1,latitude_chargement:60.05,longitude_chargement:-43.1667,title:"THIS IS FRANCE"},{id:2,latitude_chargement:45.7604,longitude_chargement:5.68552,title:"THIS IS GREENLAND"},{id:3,latitude_chargement:48.853873,longitude_chargement:2.351074,title:"THIS IS PARIS"}];
for(i = 0; i < arr.length; i++)
{
marker = new google.maps.Marker({
position: new google.maps.LatLng(arr[i].latitude_chargement, arr[i].longitude_chargement),
map : map,
title: arr[i].title,
icon: 'https://maps.google.com/mapfiles/ms/icons/blue-dot.png'
});
var contentString = '<div id="content">'+arr[i].title+'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
}
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
marker.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);