-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgooglemap.html
76 lines (61 loc) · 3.19 KB
/
googlemap.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Yosemite Trails</title>
<link href="https://google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var map;
function createMarker(coords, map, title, img) {
var contentString =
'<div id="content-' + title + ' class="popup" style="background: ">'+
'<div>' +
'<img src="' + img + '">' +
'<div>' + title + '</div' +
'</div>' +
'</div>';
var marker = new google.maps.Marker({
position: coords,
map: map,
title: title
});
var infowindow = new google.maps.InfoWindow({
content: contentString
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
function initialize() {
var mapOptions = {
zoom: 13,
center: new google.maps.LatLng(37.740856, -119.602661),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var marker_coord1 = new google.maps.LatLng(37.740856, -119.602661)
var marker_coord2 = new google.maps.LatLng(37.739635, -119.574165)
var marker_coord3 = new google.maps.LatLng(37.727009, -119.609528)
var marker_coord4 = new google.maps.LatLng(37.727959, -119.613819)
var marker_coord5 = new google.maps.LatLng(37.733797, -119.60146)
var img1 = "http://api.ning.com/files/jqWty7Z2-j18V8lGhYZQ8AA0kqLDZ2aSK-k9YPKVrKRTd3YkErMx3IfwvTMsoF0Y6-gqOIcxf2VQsIc3gJJD*aHhEprpbVpX/ColorsLowerFallsYellowstoneNationalPark.jpg?crop=1%3A1&width=64"
var img2 = "http://api.ning.com/files/jqWty7Z2-j18V8lGhYZQ8AA0kqLDZ2aSK-k9YPKVrKRTd3YkErMx3IfwvTMsoF0Y6-gqOIcxf2VQsIc3gJJD*aHhEprpbVpX/ColorsLowerFallsYellowstoneNationalPark.jpg?crop=1%3A1&width=64"
var img3 = "http://api.ning.com/files/jqWty7Z2-j18V8lGhYZQ8AA0kqLDZ2aSK-k9YPKVrKRTd3YkErMx3IfwvTMsoF0Y6-gqOIcxf2VQsIc3gJJD*aHhEprpbVpX/ColorsLowerFallsYellowstoneNationalPark.jpg?crop=1%3A1&width=64"
var img4 = "http://api.ning.com/files/jqWty7Z2-j18V8lGhYZQ8AA0kqLDZ2aSK-k9YPKVrKRTd3YkErMx3IfwvTMsoF0Y6-gqOIcxf2VQsIc3gJJD*aHhEprpbVpX/ColorsLowerFallsYellowstoneNationalPark.jpg?crop=1%3A1&width=64"
var img5 = "http://api.ning.com/files/jqWty7Z2-j18V8lGhYZQ8AA0kqLDZ2aSK-k9YPKVrKRTd3YkErMx3IfwvTMsoF0Y6-gqOIcxf2VQsIc3gJJD*aHhEprpbVpX/ColorsLowerFallsYellowstoneNationalPark.jpg?crop=1%3A1&width=64"
var img6 = "http://api.ning.com/files/jqWty7Z2-j18V8lGhYZQ8AA0kqLDZ2aSK-k9YPKVrKRTd3YkErMx3IfwvTMsoF0Y6-gqOIcxf2VQsIc3gJJD*aHhEprpbVpX/ColorsLowerFallsYellowstoneNationalPark.jpg?crop=1%3A1&width=64"
createMarker(marker_coord1, map, "Lower Yosemite Falls Trail", img1);
createMarker(marker_coord2, map, "John Muir Trail", img2);
createMarker(marker_coord3, map, "Valley Floor Trail", img2);
createMarker(marker_coord4, map, "Yosemite Falls Trail", img2);
createMarker(marker_coord5, map, "Cooks Meadow Trail", img6);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>