答案 0 :(得分:2)
您可以使用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的工作示例。