从Google地图中删除所有控件 [英] Removing all controls from a google map
本文介绍了从Google地图中删除所有控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图从我的地图中删除所有控件(缩放,地图类型下拉和街景)。
有一种方法
map.removeControl(GControl)
但我无法成功删除任何我没有添加的默认选项。
关于删除/清除所有控件的提示你有没有试过这个:
http://code.google.com/apis/maps/documentation/javascript/ controls.html#DisablingDefaults
函数初始化(){
var myOptions = {
zoom:4,
center:new google.maps.LatLng(-33,151),
disableDefaultUI:true,
mapTypeId:google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById(map _canvas),
myOptions);
}
I am trying to remove all the controls (zoom, map type drop down, and street view) from my map.
There's a method
map.removeControl(GControl)
but I haven't been able to successfully remove any default ones that I hadn't added myself.
Any tips on remove/clearing all controls from the map?
解决方案
Have you tried this:
http://code.google.com/apis/maps/documentation/javascript/controls.html#DisablingDefaults
function initialize() {
var myOptions = {
zoom: 4,
center: new google.maps.LatLng(-33, 151),
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
这篇关于从Google地图中删除所有控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文