0
我在下面的代碼中生成一個Google地圖,但地圖不以標記爲中心。我做了一些研究,但無法弄清楚。無法以Google地圖中的標記爲中心
的JavaScript代碼使用:
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 });
}
謝謝,我試過,但好像它不顯示在地圖中心任何方式。上面的代碼說,它應該工作。但我正在動態創建Google地圖,這可能是您認爲的問題嗎? – Kim 2013-05-13 13:19:09