初始化后是否有办法显示/隐藏google map中的所有UI控件? [英] Is there a way to show/hide all the UI controls from google map after initialised?
本文介绍了初始化后是否有办法显示/隐藏google map中的所有UI控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在加载Google Maps之前,Google Maps上有一个将disableDefaultUI设置为false的选项.
There is an option on Google Maps disableDefaultUI set to false before loading google Maps.
function initMap(){
var mapVar = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: {lat: -33, lng: 151},
disableDefaultUI: true
});
}
渲染地图后,是否可以使用mapVar变量隐藏所有控件?
Is there any way to hide all the controls using my mapVar variable once the map is rendered?
从google地图中删除所有控件-这个问题是关于在加载时隐藏地图.
Removing all controls from a google map - This question is about hiding the map on load.
推荐答案
有一种动态隐藏控件的方法.
There is a method to hide controls dynamically.
mapVar.setOptions({disableDefaultUI:true});
如果我们要隐藏单个选项mapVar.setOptions({zoomControl:false});
In case if we want to hide a single option mapVar.setOptions({zoomControl:false});
这篇关于初始化后是否有办法显示/隐藏google map中的所有UI控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文