-
Notifications
You must be signed in to change notification settings - Fork 0
/
Multiplemarkers.html
43 lines (34 loc) · 1.27 KB
/
Multiplemarkers.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<body>
<h1>Multiple Land Marks
<br>
</h1>
<center>
<h3>Click wherever the place you want to add a marker</h3>
</center>
<div id="map" style="width:100%;height:500px;"></div>
<script>
function myMap() {
var mapCanvas = document.getElementById("map");
var myCenter = new google.maps.LatLng(6.8210555, 80.0405499);
var mapOptions = { center: myCenter, zoom: 12 };
var map = new google.maps.Map(mapCanvas, mapOptions);
google.maps.event.addListener(map, 'click', function (event) {
placeMarker(map, event.latLng);
});
}
function placeMarker(map, location) {
var marker = new google.maps.Marker({
position: location,
map: map, animation: google.maps.Animation.BOUNCE
});
var infowindow = new google.maps.InfoWindow({
content: 'Latitude: ' + location.lat() + '<br>Longitude: ' + location.lng()
});
infowindow.open(map, marker);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=(YOUR API KEY)&callback=myMap"></script>
</body>
</html>