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

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -