Ajuda com script do Google Maps
Hello friends.
Estou com um codigo javascript do google maps funcionando perfeitamente (exibe os marcadores personalizados, cordenadas, nomes etc de um array list). porém, preciso que quando clicado no icone (pin ou marcador) abra um window com o nome, e link assim que clicado.
alguem pode me ajudar nessa ai? segue o codigo completo:
<script>
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 14,
scrollwheel: false,
zoomControl : true,
panControl : false,
//streetViewControl : true,
mapTypeControl: false,
//overviewMapControl: true,
center: {lat: -19.4710913, lng: -42.5563031}
//center: {lat: -5.18229664, lng: -37.35511959}
});
setMarkers(map);
}
// Data for the markers consisting of a name, a LatLng and a zIndex for the
// order in which these markers should display on top of each other.
var lista = [
['Bondi Beach', -19.457739, -42.555077, 1,'images/pin.png'],
['Coogee Beach', -19.455503, -42.554980, 2,'images/pin.png'],
['Cronulla Beach', -19.448637, -42.555208, 3,'images/pin.png']
];
function setMarkers(map) {
var shape = {
coords: [1, 1, 1, 20, 18, 20, 18, 1],
type: 'poly'
};
for (var i = 0; i < lista.length; i++) {
var anuncio = lista[i];
//----------------------------------------------
var marker = new google.maps.Marker({
position: {lat: anuncio[1], lng: anuncio[2]},
map: map,
icon: anuncio[4],
shape: shape,
title: anuncio[0],
// zIndex: anuncio[3]
});
//---------------------------------------------
}
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?callback=initMap"></script>Discussão (0)
Carregando comentários...