Javascript 如何从谷歌地图信息窗口弹出窗口中删除关闭按钮(x)边框?

Javascript 如何从谷歌地图信息窗口弹出窗口中删除关闭按钮(x)边框?,javascript,google-maps,google-maps-markers,infowindow,Javascript,Google Maps,Google Maps Markers,Infowindow,有没有办法摆脱谷歌地图信息窗口中关闭(x)按钮周围的边界? 我已经尝试了所有我能找到的关于堆栈溢出的方法 这不起作用: .gm-style .gm-style-iw + div { display: none; /* <-- this will generally work on the fly. */ visibility: hidden; /* this 2 lines below are just for hard hiding. :) */ opacity: 0;} 替换信息窗

有没有办法摆脱谷歌地图信息窗口中关闭(x)按钮周围的边界?

我已经尝试了所有我能找到的关于堆栈溢出的方法

这不起作用:

.gm-style .gm-style-iw + div {
display: none; /* <-- this will generally work on the fly. */
visibility: hidden; /* this 2 lines below are just for hard hiding. :) */
opacity: 0;}

替换信息窗口中的图像可能是另一种解决方案?有什么方法可以做到这一点吗?

现在屏幕截图中的x周围似乎有很多填充物。我会检查元素,看看是否有来自父元素或相关类的样式覆盖了您对其边框或轮廓所做的更改。如果没有,您是否尝试过以下选择器

大纲:无

边界半径:0

基于:

InfoWindow类不提供自定义

我建议您使用,因为它在创建弹出窗口时不包含关闭按钮

function Popup(position, content) {
this.position = position;

content.classList.add('popup-bubble');

// This zero-height div is positioned at the bottom of the bubble.
var bubbleAnchor = document.createElement('div');
bubbleAnchor.classList.add('popup-bubble-anchor');
bubbleAnchor.appendChild(content);

// This zero-height div is positioned at the bottom of the tip.
this.containerDiv = document.createElement('div');
this.containerDiv.classList.add('popup-container');
this.containerDiv.appendChild(bubbleAnchor);

// Optionally stop clicks, etc., from bubbling up to the map.
google.maps.OverlayView.preventMapHitsAndGesturesFrom(this.containerDiv);
}
你可以看到这个例子


注意:请不要忘记在示例中添加API密钥。

在信息窗口的一侧尝试此操作



您是在使用框架还是在更改JS的样式?目前,这似乎是一个CSS/样式问题。请提供一个演示您的问题的示例。哇!非常感谢你!我试试这个!
function Popup(position, content) {
this.position = position;

content.classList.add('popup-bubble');

// This zero-height div is positioned at the bottom of the bubble.
var bubbleAnchor = document.createElement('div');
bubbleAnchor.classList.add('popup-bubble-anchor');
bubbleAnchor.appendChild(content);

// This zero-height div is positioned at the bottom of the tip.
this.containerDiv = document.createElement('div');
this.containerDiv.classList.add('popup-container');
this.containerDiv.appendChild(bubbleAnchor);

// Optionally stop clicks, etc., from bubbling up to the map.
google.maps.OverlayView.preventMapHitsAndGesturesFrom(this.containerDiv);
}