forked from jgee92/West_Cuesta
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
122 lines (105 loc) · 3.21 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="https://dl.dropboxusercontent.com/u/345322813/logos/Div6Logo_PNG_16x16.png" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<meta charset=utf-8 />
<title>West Cuesta Ridge</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.js'></script>
<script src='cuesta.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.4/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%;
}
.my-custom-control { background: url('https://dl.dropboxusercontent.com/u/345322813/logos/Div6Logo_PNG_original.png');
background-size: 150px 150px;
background-repeat: no-repeat;
background-position: center;
background-clip: border-box;
transition: background-size 0.2s;
-webkit-transition: background-size 0.2s;
transition-timing-function: cubic-bezier(.05,1.2,.72,1.2);
display: inline-block;
width: 200px;
height: 200px;
}
.my-custom-control:hover {
background-size: 200px;
}
</style>
</head>
<body>
<div id='map'></div>
<script>
var map = L.mapbox.map('map', 'slugis.g8ne0hp0', {
closePopupOnClick:false
}).setView([35.381, -120.674], 13);
var MyControl = L.Control.extend({
options: {
position: 'bottomleft'
},
onAdd: function (map) {
// create the control container with a particular class name
// ** you can add the image to the div as a background image using css
var imageLink = document.createElement('a');
imageLink.href = 'http://slocountyfire.org/';
var container = L.DomUtil.create('div', 'my-custom-control');
imageLink.appendChild(container);
// ... initialize other DOM elements, add listeners, etc.
return imageLink;
}
});
map.addControl(new MyControl());
// Generate a GeoJSON line. You could also load GeoJSON via AJAX
// or generate it some other way.
function style(feature) {
return {
weight: 7,
opacity: 1,
color: '#0d8709',
opacity: 0.7
};
}
var line = L.geoJson(cuesta, {
style: style
}).addTo(map);
var marker = L.marker([0, 0], {
icon: L.mapbox.marker.icon({
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [-120.630,35.347]
},
properties: {
'marker-symbol': 'star'
}
})
}).addTo(map);
// a shortcut to accessing the line's coordinate list
var coords = cuesta.features[0].geometry.coordinates,
i = 0;
function tick() {
marker.setLatLng([coords[i][1], coords[i][0]]);
// ensure the marker doesn't fall off the end of
// the list of coordinates.
// 18ms is the time interval between points
if (++i < coords.length) setTimeout(tick, 500);
}
// start the animation
tick();
marker.bindPopup('<iframe width="300" height="300" src="https://www.youtube.com/embed/GYJ23Bf_zV0?autoplay=1&controls=0&showinfo=0" frameborder="0" allowfullscreen></iframe>', {
keepInView: false,
autoPan: false,
closeButton: false,
maxWidth: 1000
}).openPopup();
marker._popup.setLatLng = function(latlng) {
this._latlng = L.latLng(latlng);
this._updatePosition();
this._adjustPan();
};
</script>
</body>
</html>