Reputation: 13
With gmap3, I can put a "variable" for latitude and longitude, but for the "zoom" it's impossible.
var latitude = $('#lat_Value').text();
var longitude = $('#long_Value').text();
var mapZoom = $('#zoom_Value').text();
$("#map1").gmap3({
marker:{ latLng:[latitude, longitude] },
map:{
options:{
zoom: 16, // This is working...
mapTypeId: google.maps.MapTypeId.SATELLITE
}
}
});
$("#map2").gmap3({
marker:{ latLng:[latitude, longitude] },
map:{
options:{
zoom: mapZoom, // This doesn't works !!..Why?
mapTypeId: google.maps.MapTypeId.SATELLITE
}
}
});
Here an exemple with two maps : the first map, with a number for the "zoom value" (it's working), and the second map with a variable for the "zoom value" (it doesn't work !). What's the problem ? Thanks.
Upvotes: 1
Views: 391
Reputation: 1905
The value is a text value and somehow that must be the reason why its not working. Try parseInt() on the value.
var mapZoom = parseInt($('#zoom_Value').text());
Upvotes: 1