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

问题描述

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


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:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 20:47