react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

Remove 'x' close button from InfoWindow?

Open warrenkpl opened this issue 5 years ago • 5 comments

Getting Help

How can I remove 'x' close button from InfoWindow, is there a way to target it with CSS styling?

warrenkpl avatar Oct 31 '18 16:10 warrenkpl

This should do it: .gm-style-iw + div {display: none;}

taken from Stackoverflow

jamesmosier avatar Oct 31 '18 23:10 jamesmosier

=============  HTML  ==============
<agm-map #gm [latitude]="lat" [longitude]="lng" #AgmMap [fitBounds]="true">
 <agm-marker
          (mouseOver)="onMouseOver(infoWindow, gm)"
          (mouseOut)="onMouseOut(infoWindow, gm)"
        >

         <div id="test">
            <agm-info-window #infoWindow></agm-info-window>
          </div>
        </agm-marker>
      </agm-map>

=============  TS  ==============

onMouseOver(infoWindow, gm) {
console.log(infoWindow);
if (gm.lastOpen != null) {
 gm.lastOpen.close();
}
gm.lastOpen = infoWindow;
infoWindow.open();
setTimeout(() => {
  var x = document.getElementsByClassName('gm-ui-hover-effect')[0].remove();
}, 10);
}
onMouseOut(infoWindow, gm) {
gm.lastOpen = infoWindow;
infoWindow.close();}

OmarioHassan avatar May 23 '19 13:05 OmarioHassan

button.gm-ui-hover-effect {
    visibility: hidden;
}

Working on Chrome 86

ghost avatar Oct 28 '20 21:10 ghost

@ghost you rock, worked like a charm, thank you!!

tvaroglu avatar Oct 21 '22 16:10 tvaroglu