GMaps V3 InfoWindow - disable the close “x” button

前端 未结 22 1061
青春惊慌失措
青春惊慌失措 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 10:04

    I used the answer given by Tushar Gaurav, but expanded it a little...

    $(".gm-style-iw:contains(" + infoText + ")").css("left", function() {
        return ($(this).parent().width() - $(this).width()) / 2;
    }).next("div").remove();
    

    That will remove the X from an infowindow with the text in infoText, and then recenter the text as it's off-center after removing the close button.

    Just adding this for anyone else who stumbles across this page as I did.

提交回复
热议问题