如何谷歌地图infoWindow总是显示

时间:2017-09-15 11:31:07

标签: javascript google-maps

如何让我的infoWindow始终显示?

map.addMarker({
        lat: 2.198436,
        lng: 102.244621,
        title: 'Company Name',
        infoWindow: {
            content: contentMarker
        },
        icon : 'css/colors/orange/images/icon-marker.png'
    });

1 个答案:

答案 0 :(得分:0)

单击标记后显示infowindow的代码:它会显示infowindow,直到您关闭。

var infowindow = new google.maps.InfoWindow({
      content: ""
    });

    var marker = new google.maps.Marker({
      position: ,
      map: map,
      title: ''
    });
    marker.addListener('click', function() {
      infowindow.open(map, marker);
    });

如果你想默认看到infowindow:

var infowindow = new google.maps.InfoWindow({
   content: contentString,
   maxWidth: 200
});

var marker = new google.maps.Marker({
   position: uluru,
   map: map,
   title: 'Uluru (Ayers Rock)'
});
marker.addListener('click', function() {
   infowindow.open(map, marker);
});

infowindow.open(map, marker);

刚刚添加了infowindow.open(地图,标记);下方。