1
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script src="js/jquery.gmap.js"></script>
<script type="text/javascript">
$('#myModal').modal('show');
function initialize() {
var mapOptions = {
controls: {
panControl: true,
zoomControl: true,
mapTypeControl: true,
scaleControl: true,
streetViewControl: true,
overviewMapControl: true
},
scrollwheel: false,
zoom: 6,
center: new google.maps.LatLng(-23, -44)
}
var map = new google.maps.Map(document.getElementById('googlemaps'), mapOptions);
setMarkers(map, affiliates);
}
var affiliates = [
['São Paulo', -23.544778, -46.640443],
['Curitiba', -25.430424, -49.267594, 5],
['Porto Alegre', -30.029993, -51.228282, 3],
['Ribeirão Preto', -21.175955, -47.810941, 2],
['Limeira', -22.564294, -47.404107, 1],
['Rio de Janeiro', -22.901542, -43.180402, 1]
];
function setMarkers(map, locations) {
var image = {
url: 'images/boneco_base.png',
size: new google.maps.Size(22, 30),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(0, 32)
};
var shape = {
coords: [1, 1, 1, 20, 18, 20, 18, 1],
type: 'poly'
};
for (var i = 0; i < locations.length; i++) {
var affiliate = locations[i];
var myLatLng = new google.maps.LatLng(affiliate[1], affiliate[2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image,
shape: shape,
title: affiliate[0],
zIndex: affiliate[3]
});
}
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
У меня есть код выше, чтобы показать мои филиалы, но я хочу, когда пользователь нажимает на изображение, показывает всплывающую подсказку, где он показывает более подробную информацию.API-интерфейс API Карт Google
я уже пытался поставить некоторые коды внутри for
, но он не работает для меня
как я могу это сделать?