Google地图V3:关闭地标infowindows [英] Google Maps V3: turning landmark infowindows off
问题描述
如何删除信息窗口,但保持实际的地标可见?我只是不希望实际的信息窗口出现在点击地标时,因为我在地标附近有标记,有时地标会被意外点击。 这些名为 clickableIcons
。
要关闭 InfoWindows
,设置 MapOption
clickableIcons:false
。
从文档
:
clickableIcons |类型:布尔型
如果为false,则地图图标不可点击。地图图标代表兴趣点,也称为兴趣点。默认地图图标是可点击的。
代码段:
$ b
function initialize(){var map = new google.maps.Map(document.getElementById(map_canvas),{ center:new google.maps.LatLng(37.4419,-122.1419),zoom:13,mapTypeId:google.maps.MapTypeId.ROADMAP,clickableIcons:false});} google.maps.event.addDomListener(window,load, );
<,c $ c> html,body,#map_canvas {height: 100%;宽度:100%; margin:0px; < script src =https:// //maps.googleapis.com/maps/api/js\"></script><div id =map_canvas>< / div>
How can I remove the info-windows but keep the actual landmark visible? I just don't want the actual info-window to appear when the landmark is clicked because I have markers around landmarks and sometimes the landmarks are accidentally clicked instead.
Those are called clickableIcons
.
To turn off the InfoWindows
, set the MapOption
clickableIcons: false
.
From the documentation :
clickableIcons | Type: boolean
When false, map icons are not clickable. A map icon represents a point of interest, also known as a POI. By default map icons are clickable.
code snippet:
function initialize() {
var map = new google.maps.Map(
document.getElementById("map_canvas"), {
center: new google.maps.LatLng(37.4419, -122.1419),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP,
clickableIcons: false
});
}
google.maps.event.addDomListener(window, "load", initialize);
html,
body,
#map_canvas {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<div id="map_canvas"></div>
这篇关于Google地图V3:关闭地标infowindows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!