GMaps V3 InfoWindow - disable the close “x” button

前端 未结 22 1076
青春惊慌失措
青春惊慌失措 2020-12-05 09:14

From what I see, in v2 of GMaps API there was a property \"buttons\" of the InfoWindow object that one could define in a way that given InfoWindow has no close button:

22条回答
  •  心在旅途
    2020-12-05 09:56

    google.maps.event.addListener(infowindow, 'domready', function() {
    
        var iwOuter = jQuery('.gm-style-iw');
    
        // Reference to the div that groups the close button elements.
        var iwCloseBtn = iwOuter.next();
    
        // Apply the desired effect to the close button
        iwCloseBtn.remove()
    });
    

    As there is no option to hide this by API parameter, you have to find the element by targeting the content window and remove it.

    Hope this helps :)

提交回复
热议问题