简体   繁体   English

是否可以在 google maps api 中为一个标记打开多个 infoWindows?

[英]Is it possible to open multiple infoWindows for one marker in google maps api?

I am working on a project, and they want to look the infowindows like this:我正在做一个项目,他们希望信息窗口看起来像这样:

[![enter image description here][1]][1] [![在此处输入图像描述][1]][1]

How is this possible and which library would you recommend?这怎么可能,你会推荐哪个图书馆?

In Google maps v3 it is possible by creating custom event listeners and modifying autocentering.在谷歌地图 v3 中,可以通过创建自定义事件侦听器和修改自动居中。 Examples can be found here: http://you.arenot.me/2010/06/29/google-maps-api-v3-0-multiple-markers-multiple-infowindows/示例可以在这里找到:http: //you.arenot.me/2010/06/29/google-maps-api-v3-0-multiple-markers-multiple-infowindows/

Several infowindows for one marker (not tested):一个标记的多个信息窗口(未测试):

var infowindow = new google.maps.InfoWindow();
var infowindow2 = new google.maps.InfoWindow();
var marker = new google.maps.Marker({
  position:latLng,
  map: map
});

google.maps.event.addListener(marker, 'click', function(content){
  return function(){
    infowindow.setContent(content);
    infowindow.open(map, this);
    infowindow2.setContent(content+'222');
    infowindow2.open(map, this);
  }
}(content));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM