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

查看:187
本文介绍了谷歌地图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';
    }
});

这是设置了锚和挂钩在code,你就可以使用样式的一些信息窗口的,但更inportantly最后一块(环路)将摆脱箭头件。

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.

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

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