GMaps V3 InfoWindow - disable the close “x” button

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

    Using Archers method I need to do

    $(".gm-style-iw").css("left", function() { //remove close and recenter
      return ($(this).parent().width() - $(this).find(">:first-child").width()) / 2;
    }).next("div").remove();
    
    0 讨论(0)
  • 2020-12-05 10:19

    Inspect it - it's a div with a class of close on it - you can target it with CSS and set it to display: none;

    0 讨论(0)
  • 2020-12-05 10:21

    My solution:

                google.maps.event.addListener(marker, 'click', function() {
    
                var wnd = new google.maps.InfoWindow({
                    content: "<table id='viewObject' >...</table>"
                });
    
                google.maps.event.addListener(wnd, 'domready', function(){
    
                    $("#viewObject").parent().parent().next().remove();
                });
    
                wnd.open(map, marker);
            });
    
    0 讨论(0)
  • 2020-12-05 10:21

    in jQuery's gmap3 plugin this can be accomplished using

    google.maps.event.addListener($('#map').gmap3({get:{name:"infowindow"}}), 'domready', function(){
        $(".gm-style-iw").next("div").remove();
    });
    
    0 讨论(0)
提交回复
热议问题