forked from devlint/osmLeaflet.jQuery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minimal_english.html
61 lines (61 loc) · 2.06 KB
/
minimal_english.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
<!DOCTYPE html>
<html>
<head>
<title>osmLeaflet.jQuery, plugin jQuery for Open Street Map</title>
<link href="http://leaflet.cloudmade.com/dist/leaflet.css" rel="stylesheet"/>
</head>
<body>
<p>Please, have a look into sources comments to understand</p>
<br />
<div id="map" style="height: 700px; width: 960px;"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://leaflet.cloudmade.com/dist/leaflet.js"></script>
<script type="text/javascript" src="osmLeaflet.jquery.js"></script>
<script>
$(document).ready(function () {
// Caching of the map
var $map = $("#map");
// Intanstiation of the map
$map.osmLeaflet({
zoom : 9,
latitude : 51.50,
longitude : -0.09
});
// Add a single marker
$map.osmLeaflet('addMarker', {
latitude : 51.50,
longitude : -0.09
});
// Add a popup
$map.osmLeaflet('addPopup', {
latitude : 51.74,
longitude : -0.17,
// Leaflet popups supports HTML content
content : '<b>Hello !</b>',
autoPan : true
});
// Add more than one marker at a time
$map.osmLeaflet('addMarker', [
{
latitude : 51.40,
longitude : 0.15,
click : 'Marker 1 of 2'
},
{
latitude : 51.40,
longitude : 0.21,
icon : {
iconUrl : 'http://leaflet.cloudmade.com/docs/images/leaf-green.png',
shadowUrl : 'http://leaflet.cloudmade.com/docs/images/leaf-shadow.png',
iconSize : [38, 95], // size of the icon
shadowSize : [50, 64], // size of the shadow
iconAnchor : [22, 94], // point of the icon which will correspond to marker's location
shadowAnchor : [4, 62], // the same for the shadow
popupAnchor : [-3, -76] // point from which the popup should open relative to the iconAnchor
}
}
]);
});
</script>
</body>
</html>