我正在尝试更新我网站上的地图系统,以便为Google Maps v3使用更新的插件。我决定使用的插件是:
https://hpneo.github.io/gmaps/examples.html
我已经让它工作了,但我不能为我的生活找出如何禁用控件:
基本上,所有我用红色标记的位,我都不想显示。以下是我实际调用地图的方式:
modal_map = new GMaps({
div: '#popup_map',
lat: coords[0],
lng: coords[1]
});
有人可以建议我如何删除控件吗?正如你所看到的,我在一个相当狭小的空间 - 所以我不想让它们浪费在这些位上:)
答案 0 :(得分:0)
您可以将Google Maps Javascript API v3记录的控制选项传递给GMap构造函数:
disableDefaultUI: true
代码段
var geocoder;
var map;
var coords = [37.4419, -122.1419];
function initialize() {
var modal_map = new GMaps({
div: '#popup_map',
lat: coords[0],
lng: coords[1],
disableDefaultUI: true
});
modal_map.map.set("disableDefaultUI", true);
}
google.maps.event.addDomListener(window, "load", initialize);
html,
body,
#popup_map {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script src="https://hpneo.github.io/gmaps/gmaps.js"></script>
<div id="popup_map"></div>