当我输入一个位置(城市或国家)并且信息窗口打开时,以下代码将仅在打开的信息窗口区域内找到位置:
function codeAddress() {
var address = document.getElementById("address").value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
map.fitBounds(results[0].geometry.viewport);
} else {
alert("Sorry, we couldn't find the location for the following reason: " + status);
}
});
}
我想在没有 fitBounds 的情况下缩放到位置视口
这种作品:
map.setZoom(13);
但我不想指定缩放级别
这是后一个代码的链接:http: //www.hostelbars.com/map_test_v3_3.html
我会很感激一些帮助 - 谢谢!