-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path07_Markers_Infowindows Quiz.html
145 lines (135 loc) · 4.07 KB
/
07_Markers_Infowindows Quiz.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!-- This is the corresponding "starter code" for 07_Markers/Infowindows in Udacity and Google's Maps
API Course, Lesson 1 -->
<html>
<head>
<!-- styles put here, but you can include a CSS file and reference it instead! -->
<style type="text/css">
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
// Create a map variable
var map;
// Function to initialize the map within the map div
function initMap() {
var styles = [{
featureType: 'water',
stylers: [{
color: '#ffffff'
}]
}, {
featureType: 'administrative',
elementType: 'labels.text.stroke',
stylers: [{
color: '#ffffff'
},
{
weight: 6
}
]
}, {
featureType: 'administrative',
elementType: 'labels.text.fill',
stylers: [{
color: '#e85113'
}]
}, {
featureType: 'road.highway',
elementType: 'geometry.stroke',
stylers: [{
color: '#efe9e4'
},
{
lightness: -40
}
]
}, {
featureType: 'transit.station',
stylers: [{
weight: 9
},
{
hue: '#e85113'
}
]
}, {
featureType: 'road.highway',
elementType: 'labels.icon',
stylers: [{
visibility: 'off'
}]
}, {
featureType: 'water',
elementType: 'labels.text.stroke',
stylers: [{
lightness: 100
}]
}, {
featureType: 'water',
elementType: 'labels.text.fill',
stylers: [{
lightness: -100
}]
}, {
featureType: 'poi',
elementType: 'geometry',
stylers: [{
visibility: 'on'
},
{
color: '#f0e4d3'
}
]
}, {
featureType: 'road.highway',
elementType: 'geometry.fill',
stylers: [{
color: '#efe9e4'
},
{
lightness: -25
}
]
}];
map = new google.maps.Map(document.getElementById('map'), {
center: {
lat: 40.74135,
lng: -73.99802
},
zoom: 14,
styles: styles,
mapTypeControl: false
});
// Create a single latLng literal object.
var singleLatLng = {
lat: 40.74135,
lng: -73.99802
};
var marker = new google.maps.Marker({
position: singleLatLng,
map: map,
title: 'Marky Marker'
});
var infowindow = new google.maps.InfoWindow({
content: 'This place is a place'
});
marker.addListener('click', function() {
infowindow.open(map, marker);
});
}
</script>
<!--TODO: Insert your API Key in the below call to load the API.-->
<script async defer src="https://maps.googleapis.com/maps/api/js?v=3&key=AIzaSyDPnbAKZIM7ZRYxqYoGu-PCUoV5XWxKg5Q&callback=initMap">
</script>
</body>
</html>