-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsimple.html
144 lines (123 loc) · 3.71 KB
/
simple.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<title>Leaflet Location Picker Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="//unpkg.com/[email protected]/dist/leaflet.css" />
<link rel="stylesheet" href="../src/leaflet-locationpicker.css" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h3><a href="../"><big>◄</big> Leaflet Location Picker</a></h3>
<h4>Simple Example: <em></em></h4>
<form id="insert">
<label>Insert new geographic location:</label><br />
<input class="geolocs" type="text" value="" size="20" />
<pre>
$('.geolocs').leafletLocationPicker();
</pre>
</form>
<form id="default">
Change default geographic location: <br />
<input class="geolocs" type="text" value="17.9787,81.0352" size="20" />
</form>
<form id="format">
Custom location format: <br />
<input id="geoloc2" type="text" value="" size="20" /> <br />
<pre>
$('#geoloc2').leafletLocationPicker({
locationFormat: '{lat}@{lng}#WGS84',
position: 'bottomleft'
});
</pre>
</form>
<form id="callback">
Custom callback: <br />
<input id="geoloc4" type="text" value="" size="20" />
<br /><br />
<i>Value from callback:</i><br />
<em style="color:blue"></em><br />
<pre>
$('#geoloc4').leafletLocationPicker(function(e) {
$(this).siblings('em').text(e.location);
});
</pre>
</form>
<form id="events">
Events: <em style="color:red"></em><br />
<input id="geoloc3" type="text" value="" size="20" />
<br />
<br /><input id="geolat" type="text" value="" size="20" />
<br /><input id="geolng" type="text" value="" size="20" />
<br /><i>string location</i><br />
<pre>
$('#geoloc3').leafletLocationPicker({
locationSep: ' - '
})
.on('show', function(e) {
$(this).siblings('em').text('click on map for insert the location');
})
.on('hide', function(e) {
$(this).siblings('em').text('');
})
.on('changeLocation', function(e) {
$(this)
.siblings('#geolat').val( e.latlng.lat )
.siblings('#geolng').val( e.latlng.lng )
.siblings('i').text('"'+e.location+'"');
});
</pre>
</form>
<script src="//unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
<form id="fixedContAlwaysOpen">
Fixed container and always open map: <br />
<div style="min-height: 140;min-width: 200;">
<input id="geoloc5" type="text" value="" size="20" />
<div id="fixedMapCont" style="border: 1px solid black; min-height: 140;min-width: 200;"></div>
</div>
<pre>
$('#geoloc5').leafletLocationPicker({
alwaysOpen: true,
mapContainer: "#fixedMapCont"
});
</pre>
</form>
<script src="../src/leaflet-locationpicker.js"></script>
<script>
//multiple istances
$('.geolocs').leafletLocationPicker();
//custom location format
$('#geoloc2').leafletLocationPicker({
locationFormat: '{lat}@{lng}#WGS84',
position: 'bottomleft'
});
//events
$('#geoloc3').leafletLocationPicker({
locationSep: ' - '
})
.on('show', function(e) {
$(this).siblings('em').text('click on map for insert the location');
})
.on('hide', function(e) {
$(this).siblings('em').text('');
})
.on('changeLocation', function(e) {
$(this)
.siblings('#geolat').val( e.latlng.lat )
.siblings('#geolng').val( e.latlng.lng )
.siblings('i').text('"'+e.location+'"');
});
//callback
$('#geoloc4').leafletLocationPicker(function(e) {
$(this).siblings('em').text(e.location);
});
//fix n alwaysOpen
$('#geoloc5').leafletLocationPicker({
alwaysOpen: true,
mapContainer: "#fixedMapCont"
});
</script>
<div id="copy"><a href="https://opengeo.tech/">Opengeo.tech</a> • <a rel="author" href="https://opengeo.tech/stefano-cudini/">Stefano Cudini</a></div>
</body>
</html>