在Google地图中,如何使多个重叠的标记在单击时打开自己的信息窗口 [英] How can you make multiple overlapping markers in Google Maps open their own infowindow when one is clicked

查看:932
本文介绍了在Google地图中,如何使多个重叠的标记在单击时打开自己的信息窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在javascript中使用Google Maps API V3。我有多个彼此靠近的标记。我想要这样做,以便当用户单击标记时,该标记的信息窗口和与其重叠的任何标记将打开(我需要将事件单击到与点击的像素重叠的所有其他标记)。我可以得到最高的z-indexed标记的信息窗口打开,但是我也需要打开标记的窗口。可以这样做吗?如果是这样呢?

解决方案

尝试OverlappingMarkerSpiderfier



https://github.com/jawj/OverlappingMarkerSpiderfier



这里有一个演示 - http://jawj.github.com/OverlappingMarkerSpiderfier/ demo.html



它尝试提供与地球Api相同的集群行为。


I am using Google Maps API V3 in javascript. I have multiple markers that are in a close proximity to each other. I want to make it so that when a user clicks a marker the infowindow of that marker and any markers overlapping it will open (I need to bubble the event click to all the other markers that overlap the clicked pixel). I can get the infowindow of the highest z-indexed marker to open, but I need to open the windows of the markers underneath too. Can this be done, and if so how?

解决方案

Try OverlappingMarkerSpiderfier

https://github.com/jawj/OverlappingMarkerSpiderfier

There is a demo here - http://jawj.github.com/OverlappingMarkerSpiderfier/demo.html

It attempts to give the same 'clustering' behaviour as the Earth Api.

这篇关于在Google地图中,如何使多个重叠的标记在单击时打开自己的信息窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆