prop_up 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,50 @@
1
+ $(document).ready(function(){
2
+ if ($('#leaflet-map').length > 0) {
3
+ var latitude = 25.2000;
4
+ var longitude = 55.3000;
5
+
6
+ var map = L.map('leaflet-map').setView([25.2000, 55.3000], 11);
7
+
8
+ L.tileLayer('http://{s}.tile.cloudmade.com/CLOUDMADE_API_KEY_GOES_HERE/997/256/{z}/{x}/{y}.png', {
9
+ attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
10
+ maxZoom: 18
11
+ }).addTo(map);
12
+
13
+ // add a marker in the given location, attach some popup content to it and open the popup
14
+ var marker;
15
+
16
+ marker = L.marker([25.2000, 55.3000]);
17
+
18
+ marker.addTo(map).bindPopup('Drag Me!').openPopup();
19
+
20
+ // This enables a draggable/droppable pin
21
+
22
+ marker.dragging.enable();
23
+
24
+ marker.on('dragend', function(e){
25
+ // do stuff
26
+ });
27
+ });
28
+
29
+ $('#places').on( 'submit', function(e) {
30
+ e.preventDefault();
31
+ // var query = $('#places').val()
32
+ // $.ajax({
33
+ // url: '/search_query',
34
+ // type: 'POST',
35
+ // data: { query: query }
36
+ // }).done(function(data){
37
+ // var locLatitude = parseFloat(data.latitude);
38
+ // var locLongitude = parseFloat(data.longitude);
39
+ // map.removeLayer(marker);
40
+ // map.setView([locLatitude, locLongitude], 11);
41
+ // marker = L.marker([locLatitude, locLongitude]);
42
+ // marker.addTo(map);
43
+ // marker.dragging.enable();
44
+
45
+ // marker.on('dragend', function(e){
46
+ // do stuff
47
+ // });
48
+ });
49
+ });
50
+ });