jquery - Cannot center on the marker in Google Maps -
i have code below generate google map, map doesn't center @ marker. i've done research can't figure out.
the javascript code use:
if (status == google.maps.geocoderstatus.ok) { latitude = results[0].geometry.location.lat(); longitude = results[0].geometry.location.lng(); $('#map_canvas').gmap('addmarker', { position: latitude + ',' + longitude, center: latitude + ',' + longitude, zoom: 10, draggable:false }); }
try -
var c = new google.maps.latlng(latitude , longitude); $('#map_canvas').gmap('addmarker', { position: c , zoom: 10, draggable:false }); $('#map_canvas').gmap({'center': c});
Comments
Post a Comment