-2
我有一個地圖,並有一個標記,我想適合放大它,這是我試過。使谷歌地圖縮放適合標記
var mapCenter = new google.maps.LatLng(lat, lng);
agentMap.setCenter(mapCenter);
agent_marker.setPosition(mapCenter);
也是這個
var bounds = new google.maps.LatLngBounds();
bounds.extend(agent_marker.getPosition());
agentMap.fitBounds(bounds);
他們兩人沒有工作,該標記在右上角,我想在地圖上
當您設置位置/邊界時,地圖容器大小的聲音未知。請發佈更多代碼。 –