Javascript 更改谷歌地图上标记位置的缩放?

Javascript 更改谷歌地图上标记位置的缩放?,javascript,api,maps,Javascript,Api,Maps,地址的标记将放大。如何才能使单个标记的缩放距离更远?如果有人能帮忙,那就太棒了!这是我的JavaScript。谢谢你的帮助 $('#map_here').prepend('<div id="map"></div>'); $(".static_map").remove(); var map; var bounds; var geocoder; var center; function initialize() {

地址的标记将放大。如何才能使单个标记的缩放距离更远?如果有人能帮忙,那就太棒了!这是我的JavaScript。谢谢你的帮助

$('#map_here').prepend('<div id="map"></div>');
        $(".static_map").remove();

    var map;
    var bounds;
    var geocoder;
    var center;

    function initialize() {
        var mapOptions = {
            center: new google.maps.LatLng(-34.397, 150.644),
            zoom: 5
        };
        map = new google.maps.Map(document.getElementById("map"),
        mapOptions);
        geocoder = new google.maps.Geocoder();
        bounds = new google.maps.LatLngBounds();
    }
    function addMarkerToMap(location){
        var marker = new google.maps.Marker({map: map, position: location});
        bounds.extend(location);
        map.fitBounds(bounds);
    }
    initialize();

    $("address").each(function(){
        var $address = $(this);
        geocoder.geocode({address: $address.text()}, function(results, status){
            if(status == google.maps.GeocoderStatus.OK) addMarkerToMap(results[0].geometry.location);
        });
    });

    google.maps.event.addDomListener(map, "idle", function(){
        center = map.getCenter();
    });

     $(window).resize(function(){
            map.setCenter(center);
        });            
$('map#u here')。前置('';
$(“.static_map”).remove();
var映射;
var界;
var地理编码器;
var中心;
函数初始化(){
变量映射选项={
中心:新google.maps.LatLng(-34.397150.644),
缩放:5
};
map=new google.maps.map(document.getElementById(“map”),
地图选项);
geocoder=新的google.maps.geocoder();
bounds=新的google.maps.LatLngBounds();
}
函数addMarkerToMap(位置){
var marker=new google.maps.marker({map:map,position:location});
扩展(位置);
映射边界(bounds);
}
初始化();
$(“地址”)。每个(函数(){
var$address=$(此项);
geocoder.geocode({address:$address.text()},函数(结果,状态){
if(status==google.maps.GeocoderStatus.OK)addMarkerToMap(results[0].geometry.location);
});
});
google.maps.event.addDomListener(映射,“空闲”,函数(){
center=map.getCenter();
});
$(窗口)。调整大小(函数(){
地图设置中心(中心);
});            

找到了有效的方法。我在map.fitBounds(bounds)之前添加了这段代码;它成功了:

google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
    if (this.getZoom() > 15) {
          this.setZoom(15);
    }
});