Google地图V3:关闭地标infowindows [英] Google Maps V3: turning landmark infowindows off

查看:147
本文介绍了Google地图V3:关闭地标infowindows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除信息窗口,但保持实际的地标可见?我只是不希望实际的信息窗口出现在点击地标时,因为我在地标附近有标记,有时地标会被意外点击。 这些名为 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://


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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆