Organization html

From Redazione
Revision as of 21:59, 6 March 2020 by Admin (talk | contribs)
Jump to navigation Jump to search

The coordinates of the organization
*/ // if(obj.hasOwnProperty("US")) { var key = obj["US"]; var mapCenter = [key.lat, key.long]; } else { var mapCenter = [22, 87]; } var map = L.map('map', {center : mapCenter, zoom : 6}); L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 18, attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox', id: 'examples.map-i875mjb7', noWrap : true }).addTo(map); var marker = L.marker(mapCenter).addTo(map); var updateMarker = function(lat, lng) { marker .setLatLng([lat, lng]) .bindPopup("Your location : " + marker.getLatLng().toString()) .openPopup(); return false; }; map.on('click', function(e) { $('#latInput').val(e.latlng.lat); $('#lngInput').val(e.latlng.lng); updateMarker(e.latlng.lat, e.latlng.lng); }); var updateMarkerByInputs = function() { return updateMarker( $('#latInput').val() , $('#lngInput').val()); } $('#latInput').on('input', updateMarkerByInputs); $('#lngInput').on('input', updateMarkerByInputs); });