Javascript 从谷歌地图中删除控件
我的页面上有一些小地图,我用标记簇显示标记 我真的不想在这张地图上显示任何缩放或其他工具。部分原因是工具甚至不能正确显示(无论画布大小) 我正在使用Javascript 从谷歌地图中删除控件,javascript,ruby-on-rails,google-maps,google-maps-api-3,gmaps4rails,Javascript,Ruby On Rails,Google Maps,Google Maps Api 3,Gmaps4rails,我的页面上有一些小地图,我用标记簇显示标记 我真的不想在这张地图上显示任何缩放或其他工具。部分原因是工具甚至不能正确显示(无论画布大小) 我正在使用gmaps4railsGem 这是我现在拥有的一张照片: 我想删除我用红色阻止的内容: 这是我的代码: <div style='padding: 6px; border-width: 1px; border-style: solid; border-color: #ccc #ccc #999
gmaps4rails
Gem
这是我现在拥有的一张照片:
我想删除我用红色阻止的内容:
这是我的代码:
<div style='padding: 6px;
border-width: 1px;
border-style: solid;
border-color: #ccc #ccc #999 #ccc;
-webkit-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
-moz-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
box-shadow: rgba(64, 64, 64, 0.1) 0 2px 5px;
'>
<div id="map2" style='width: 450px; height: 200px;'></div>
</div>
<script type="text/javascript">
handler2 = Gmaps.build('Google', { markers: { clusterer: {gridSize: 50, maxZoom: 5} } });
handler2.buildMap({ provider: {}, internal: {id: 'map2'}}, function(){
handler2.addMarkers(<%=raw @hash2.to_json %>);
handler2.getMap().setZoom(3);
handler2.map.centerOn([39.828127,-98.579404]);
});
</script>
handler2=Gmaps.build('Google',{markers:{cluster:{gridSize:50,maxZoom:5}}});
buildMap({provider:{},internal:{id:'map2'}},function(){
handler2.addMarkers();
handler2.getMap().setZoom(3);
handler2.map.centerOn([39.828127,-98.579404]);
});
根据,您可以使用disableDefaultUI
执行此操作
因此,在提供程序对象中传递它:
provider: {disableDefaultUI: true }
您试过了吗?非常感谢您。。。我看到了disableDefaultUI:true,但不确定如何在我的代码中实现它。。。我一直在mapOptions={}中看到它。我想mapOptions可以放在provider:{}部分。