我在使用 Google Maps API V3 时遇到问题。地图加载正确,但 zoomControl 部分隐藏。panControl 显示并完美运行,尽管在屏幕截图中它没有打开。
我试过设置:zoomControl: true
也disableDefaultUI: true
无济于事。
我的javascript如下:
function initializeMap(manuId, lat, lng, centerLat, centerLng,zoom){
var latlng = new google.maps.LatLng(centerLat, centerLng);
var myOptions = {
zoom: zoom,
center: latlng,
disableDefaultUI: true,
zoomControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP,
scrollwheel: false,
draggable : true
};
var mapDiv = document.getElementById("map_canvas");
if(!mapDiv){
var mapDiv = document.getElementById("map_canvas_"+manuId);
}
var map = new google.maps.Map(mapDiv,
myOptions);
var myLatlng = new google.maps.LatLng(lat,lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map
});
getPolygon(manuId, map);
}
var map;
function showManuMap(manuId, container, manuLat, manuLon, locLat, locLon, zoom){
showManuMap(manuId, container, manuLat, manuLon, locLat, locLon, zoom, null);
}
function showManuMap(manuId, container, manuLat, manuLon, locLat, locLon, zoom, marker){
map = new google.maps.Map(jQuery("#" + container)[0], {
zoom: zoom,
center: new google.maps.LatLng(manuLat, manuLon),
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
zoomControl: true,
scrollwheel: false,
draggable : true
});
if (locLat && locLon) {
new google.maps.Marker({
position: new google.maps.LatLng(locLat, locLon),
map: map,
icon : "https://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png"
});
}
if (marker != null) {
new google.maps.Marker({
position: new google.maps.LatLng(manuLat, manuLon),
map: map,
icon: marker
});
} else {
new google.maps.Marker({
position: new google.maps.LatLng(manuLat, manuLon),
map: map
});
}
if (manuId) {
getPolygon(manuId, map);
}
}