Answer the question
In order to leave comments, you need to log in
How to assign permanent labels to markers on the map?
Good afternoon. It is required to set permanent markers on the map. Can you tell me which way to dig?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 600px; height: 400px;"></div>
<script type="text/javascript">
var locations = [
['Магазин в ТЦ "NOVUS"', 50.555488, 30.215631, 3],
['Магазин ТЦ «Dream Town 1»', 50.516839, 30.498605, 2],
['Магазин в ТЦ «Украина»', 50.446347, 30.491926, 1],
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(50.517273, 30.359097),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
</script>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question