[Google Maps] How to close an Infowindow using "mouseout" trigger event?

Forge Component
Published on 2018-10-18 by Labs
32 votes
Published on 2018-10-18 by Labs

Hi all,

I would like to know if is possible to close an infowindow on a  marker using "mouseout" trigger event with "AddMarkerEvent" method?

I was able to implement the "mouseover" trigger event to show an infowindow on markers but I don't know how can i close the infowindow on a "mouseout" event.

Anyone already implemented something similar?

Thanks in advance for your help.


Hi all,

anyone have any idea how to achieve this?

I'm pretty sure is my JS knowledge failing here but I already tested a lot of things and I can't get this logic working....

Thanks for your help.



Hey Gonçalo,

You need to add a second marker event for the "mouseout" trigger.

In order for you to work with the same infowindow, I would suggest that you declare it as a window variable. Something like the following:

    var contentString = <YOUR HTML GOES HERE>;

    window.infowindow = new google.maps.InfoWindow({
          content: contentString

    window.infowindow.open(this.getMap(), this);

And for the 'mouseout' handler you can have something like


Hope it helps,



Hi Henrique,

Declaring infowindow as a window variable did the trick!

It's working like a charm now with your tips! ;)

Thank you very much for your help!