-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmap.html
More file actions
53 lines (47 loc) · 1.19 KB
/
map.html
File metadata and controls
53 lines (47 loc) · 1.19 KB
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
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title> My Map </title>
<style>
#map {
height: 700px;
width: 50%;
}
</style>
</head>
<body>
<h1> My Map </h1>
<div id="map"></div>
<script>
function initMap() {
// Map options
var options = {
zoom: 10.5,
center: {lat:45.5510, lng:-73.6550}
}
// New Map
var map = new google.maps.Map(document.getElementById('map'), options);
// Listen for click on map
google.maps.event.addListener(map, 'click', function(event) {
// Add marker
addMarker(event.latLng);
});
addMarker({lat: 45.4857, lng:-73.5957});
// Add marker function
function addMarker(coords) {
var marker = new google.maps.Marker({
position: coords,
map: map,
// icon:
});
}
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDlgFE88zLZjibX_uz2evLZtect3hWk0Gw&callback=initMap"
type="text/javascript">
</script>
</body>
</html>