Откройте InfoWindow для каждого полигона Google Maps V3
Надеюсь, что кто-то может помочь мне с этим вопросом. Я'я пытаюсь открыть информационные окна по клику для каждого полигона, который создали мои пользователи. Я использовал тот же код для маркера и работает хорошо, но я не могзаставить его работать для каждого многоугольника.
Есть мысли о том, как решить эту проблему?
Благодарю.
var contentString = ''+
''+
''+
'Test'+
'';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
// Показать области
result() as $f):?>
// Create an array with the coordanates of each area
var fieldid?>Coords = [
resources_data->field_latlng($f->id);?>
result() as $point):?>
new google.maps.LatLng(lat?>, lng?>),
];
// Create a polygon with the points of the area
var areaid?>=new google.maps.Polygon({
paths: areaid?>Coords,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35
});
// Add the area to the map.
areaid?>.setMap(map);
google.maps.event.addListener(areaid?>,'click',function(){
infowindow.open(map,areaid?>)
});