谷歌地图 API v3 如何删除信息窗口矩形下的箭头? [复制]

2023-12-08

是否可以删除信息窗口矩形下的箭头?

enter image description here

我真的不认为需要将其包含在此处,我只想将矩形居中于标记顶部而不带箭头。

可能的?


尽管啰嗦,但这是可能的。

this.map.infowindow = new google.maps.InfoWindow({
    content: '<div id="iw_content">' + contentString + '</div>'
});

google.maps.event.addListener(this.map.infowindow, 'domready', function () {
    el = document.getElementById('iw_content').parentNode.parentNode.parentNode;
    el.firstChild.setAttribute('class', 'closeInfoWindow');
    el.firstChild.setAttribute('title', 'Close Info Window');
    el = el.previousElementSibling || el.previousSibling;
    el.setAttribute('class', 'infoWindowBackground');
    for (i = 0; i < 11; i = i + 1) {
        el = el.previousElementSibling || el.previousSibling;
        el.style.display = 'none';
    }
});

这会在代码中设置锚点和挂钩,然后您可以使用它们来设计某些信息窗口的样式,但更重要的是,最后一部分(循环)将摆脱箭头部分。

它依赖于包含“iw_content”div 的信息窗口,因此它知道从哪里开始。显然,您可以更改它,但这可能需要与父数字略有不同。不过,你应该能够从中解决这个问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

谷歌地图 API v3 如何删除信息窗口矩形下的箭头? [复制] 的相关文章

随机推荐