我得到了一個非常小的地圖(180x120),但我仍然希望人們能夠放大和縮小。 如何僅在地圖上顯示+和 - ?谷歌地圖小控件
我在Gmap v3上。
我搜索了谷歌地圖幫助,但沒有找到任何內容,也許我沒有正確搜索。
感謝
我得到了一個非常小的地圖(180x120),但我仍然希望人們能夠放大和縮小。 如何僅在地圖上顯示+和 - ?谷歌地圖小控件
我在Gmap v3上。
我搜索了谷歌地圖幫助,但沒有找到任何內容,也許我沒有正確搜索。
感謝
地圖上顯示的控件默認取決於地圖的大小。但是,您可以通過map options關閉(或重新定位或更改)大多數控件的樣式。
在你的情況,它似乎像谷歌地圖顯示三個180x120px地圖的控制。您可以關閉這讓緊湊的變焦控制背後的地圖類型和街景視圖控件:
var myOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,
streetViewControl: false
};
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
可以禁用默認的用戶界面,使剛剛變焦按鈕 -
function initialize() {
var myOptions = {
zoom: 4,
center: new google.maps.LatLng(-33, 151),
panControl: false,
scaleControl: true,
zoomControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
見 - http://code.google.com/apis/maps/documentation/javascript/controls.html#DefaultUI以獲取更多信息。
位遲到了,但任何人試圖做同樣的,這是可以做到:
mapOptions = {
zoom: 5,
center: new google.maps.LatLng(53.737531, -5.240479),
disableDefaultUI: true,
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL,
position: google.maps.ControlPosition.LEFT_CENTER
};
參見:https://developers.google.com/maps/documentation/javascript/examples/control-positioning
非常感謝您的幫助:-) – user1040899 2012-01-13 02:44:49
你可以使控制很小。看到我的答案在下面... – DanV 2014-06-18 10:34:07