google maps API v3 如何删除信息窗口矩形下的箭头? [英] google maps API v3 how do I remove arrow under the infowindow rectangle?

查看:30
本文介绍了google maps API v3 如何删除信息窗口矩形下的箭头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is it possible to remove arrow under infowindow rectangle?

我真的不认为需要将它包含在这里,我只想将矩形放在没有箭头的标记顶部.

I really don't see need to include it here, I just want to center rectangle on the top of marker without arrow.

可能吗?

推荐答案

这是可能的,虽然冗长.

This is possible although long winded.

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';
    }
});

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

That sets up anchors and hooks in the code that you can then use to style some of the infowindow but more inportantly, the last piece (the loop) will get rid of the arrow pieces.

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

It relies on the info window containing a div of 'iw_content' so it knows where to start from. Obviously you can change that, but that may require slight differences to the parent numbers. You should be able to work it out from that though.

这篇关于google maps API v3 如何删除信息窗口矩形下的箭头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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