【发布时间】:2018-04-01 09:25:59
【问题描述】:
【问题讨论】:
标签: javascript google-maps google-maps-api-3 angular5 infowindow
【问题讨论】:
标签: javascript google-maps google-maps-api-3 angular5 infowindow
您可以使用Snazzy Info Window plugin。您创建 3 个SnazzyInfoWindow 对象并为每个对象设置不同的placement 选项。
例子:
var infoWindowData = [
{ content: 'Info Window 1', placement: 'top'},
{ content: 'Info Window 2', placement: 'right'},
{ content: 'Info Window 3', placement: 'bottom',}
];
var marker = new google.maps.Marker({
map: map,
position: { lat: 40, lng: 20 }
})
// Loop through the data and create a SnazzyInfoWindow for each item in the array
infoWindowData.forEach(function(entry) {
var infoWindow = new SnazzyInfoWindow({
marker: marker,
content: entry.content,
placement: entry.placement,
});
infoWindow.open();
})
这是a JSBin 的一个工作示例。
【讨论】: