hello

I have problem with Multiple markers with the exact same location. I create 
markers using "for "loop from array, where I have lat, lon, and url value.
I want to display infowindow with url value, using click action. Infowindow 
should show as many url addresses as there are markers.

var arr = {/literal}{$array|@json_encode}{literal}
var map;
var image_map = 'map_flag.png';
var image_map_cluster = /m';
var stylez = [
{
 featureType: "all",
 elementType: "all",
 stylers: [
{ saturation: -100 }
 ]
}
]; 
var marker;
var i, j;
var markers = new Array();
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 6,
center: new google.maps.LatLng(51.90, 19.59),
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
zoomControl: true
});
mapType = new google.maps.StyledMapType(stylez, { 
name:"Grayscale" 
});    
map.mapTypes.set('tehgrayz', mapType);
map.setMapTypeId('tehgrayz');
for (i = 0; i < arr.length; i++) {
var latlng = new google.maps.LatLng(arr[i]['lat'], arr[i]['lon']);
marker = new google.maps.Marker({
position: latlng,
map: map,
animation: google.maps.Animation.DROP,
icon: image_map,
zIndex: i,
}); 
attachSecretMessage(marker, arr[i]['link'], i);
markers.push(marker);
    }

var mc = new MarkerClusterer(map, markers, {imagePath: 
image_map_cluster,zoomOnClick: true,maxZoom:15});

}
function attachSecretMessage(marker, secretMessage, i) {
    google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
window.location.href = secretMessage;
}
})(marker, i));
}


-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.

Reply via email to