-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
47 lines (41 loc) · 1.14 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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="CanvasMarker.js"></script>
<title>CanvasMarker</title>
<style>
#map,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
position: absolute;
}
.note {
position: absolute;
background-color: white;
left: 0;
bottom: 0;
font: 20px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
padding: 10px;
}
</style>
</head>
<body>
<div id="map"></div>
<div class="note">Click on the map to create new markers</div>
</body>
<script>
'use strict';
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}').addTo(map);
var marker = L.canvasMarker([51.5, -0.09]).addTo(map);
// var markerOriginal = L.marker([51.5, -0.09]).addTo(map);
map.on('click', function(e) {
L.canvasMarker(e.latlng).addTo(map);
});
</script>
</html>