Google Maps: Auto close open InfoWindows?

前端 未结 12 710
终归单人心
终归单人心 2020-12-02 05:30

On my site, I\'m using Google Maps API v3 to place house markers on the map.

The InfoWindows stay open unless you explicitly click the close icon. Meaning, you can h

12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 06:31

    How about -

    google.maps.event.addListener(yourMarker, 'mouseover', function () {
            yourInfoWindow.open(yourMap, yourMarker);
    
        });
    
    google.maps.event.addListener(yourMarker, 'mouseout', function () {
            yourInfoWindow.open(yourMap, yourMarker);
    
        });
    

    Then you can just hover over it and it will close itself.

提交回复
热议问题