Organization html

From Redazione
Jump to navigation Jump to search
Line 491: Line 491:
  
  
function drawMap(lat,lon) {
+
function drawMap(lat,lon,zoom) {
  
 
var mapCenter = [lat,lon];
 
var mapCenter = [lat,lon];
  
var map = L.map('map_container', {center : mapCenter, zoom : 6});
+
var map = L.map('map_container', {center : mapCenter, zoom : zoom});
  
 
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
 
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
Line 550: Line 550:
 
$('.ci_form textarea').autosize();
 
$('.ci_form textarea').autosize();
  
 +
var current_coordinates = $('[name="Form organization[Coordinates]"').val();
  
 +
if(current_coordinates) {
 +
current_coordinates = current_coordinates.split(',');
 +
map = drawMap(current_coordinates[0], current_coordinates[1],10);
  
//
+
} else if(obj.hasOwnProperty("</html>{{#ci_visitorIsoCode:}}<html>")) {
if(obj.hasOwnProperty("</html>{{#ci_visitorIsoCode:}}<html>")) {
 
 
var key = obj["</html>{{#ci_visitorIsoCode:}}<html>"];
 
var key = obj["</html>{{#ci_visitorIsoCode:}}<html>"];
map = drawMap(key.lat, key.long);
+
map = drawMap(key.lat, key.long,6);
 
 
 
} else {
 
} else {
map = drawMap(22, 87);
+
map = drawMap(22, 87,6);
 
}
 
}
 
 

Revision as of 17:30, 7 March 2020

Zoom and move the map to the precise location of your organization to pick its coordinates.