0
地址標記放大。我怎樣才能讓縮放比單個標記更遠?如果任何人都可以提供幫助,那就太棒了!這是我的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);
});