So i tried to find some documentation about how to center the map on a marker, but somehow it doesn't work for me.
In the example on the Gmap3 page it works fine without adding the "center" to the map options, for me even with the "center:latLng" it wouldn't work.
so i tried some different combination nothing really works for me..
then i tried to extract the latitude and longitude separately and checked the numbers i get on a site that allows to enter lat and lng, and i realized that the coords are not those of the marker, so i don't know if i extract them right or there is another problem.
this is my code right now-
$("#mapholder").gmap3({
getgeoloc:{
callback : function(latLng){
//here is where i tried to get the lat and lng out of the latLng
lat = parseFloat(latLng.A.toFixed(6));
console.log(typeof(lat));
lng = parseFloat(latLng.k.toFixed(6));
lat_Lng = latLng;
console.log("latitude: "+lat+" , longtitude: "+lng);
console.log("typeof latlng: "+typeof(latLng));
if (latLng){
$("#mapholder").gmap3({
map:{
options:{
center:latLng,
zoom: 5
}
},
marker:{
latLng:latLng
}
});
}
}
}
});
another way i tried it was
center:[lat,lng]
and even without any center like in the demo it didn't work.
Thanks a lot for any help!
UPDATE
could it have anything to do with the callback function that doesn't allow those parameters?
i also tried to add a data type to the marker so it would say "You are here!", this doesn't work either.
console.log("latitude: "+lat+" , longtitude: "+lng);
and what is the approximate location it should show? – dkasipovic