Organization html

From Redazione
Jump to navigation Jump to search
Line 486: Line 486:
  
  
$(function(){
+
function drawMap(lat,lon) {
 
 
$('#select_countries option:contains("</html>{{#ci_visitorCountry:}}<html>")').prop('selected',true);
 
  
$('#select_countries').on('change',function() {
+
var mapCenter = [lat,lon]
 
  
})
 
 
$('.ci_form textarea').autosize();
 
 
 
 
//
 
if(obj.hasOwnProperty("</html>{{#ci_visitorIsoCode:}}<html>")) {
 
var key = obj["</html>{{#ci_visitorIsoCode:}}<html>"];
 
var mapCenter = [key.lat, key.long];
 
 
} else {
 
var mapCenter = [22, 87];
 
}
 
 
 
var map = L.map('map', {center : mapCenter, zoom : 7});
 
var map = L.map('map', {center : mapCenter, zoom : 7});
  
Line 538: Line 520:
 
updateMarker(e.latlng.lat, e.latlng.lng);
 
updateMarker(e.latlng.lat, e.latlng.lng);
 
});
 
});
 +
 +
}
 +
 +
 +
 +
$(function(){
 +
 +
$('#select_countries option:contains("</html>{{#ci_visitorCountry:}}<html>")').prop('selected',true);
 +
 +
$('#select_countries').on('change',function() {
 +
var selected_country = $(this).find('option:selected").text()
 +
for(var i in obj) {
 +
if(obj[i].name == selected_country) {
 +
drawMap(obj[i].lat, obj[i].long);
 +
break;
 +
}
 +
}
 +
})
 +
 +
$('.ci_form textarea').autosize();
 +
 +
 +
 +
//
 +
if(obj.hasOwnProperty("</html>{{#ci_visitorIsoCode:}}<html>")) {
 +
var key = obj["</html>{{#ci_visitorIsoCode:}}<html>"];
 +
drawMap(key.lat, key.long);
 +
 +
} else {
 +
drawMap(22, 87);
 +
}
 +
 +
  
 
/*
 
/*

Revision as of 09:46, 7 March 2020

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