[英]Click to focus on InfoWindow on Google Maps API v3
Much like any OS where if you click on a window then it brings that window in focus (on top). 就像任何操作系统一样,如果您单击一个窗口,那么它将使该窗口成为焦点(顶部)。 Is that also possible if you have two overlapping InfoWindow for Google Maps API v3?
如果您有两个重叠的InfoWindow for Google Maps API v3,也可以这样做吗?
I know that there is no click
listener for InfoWindow
class as shown in the official Google Maps API v3 reference . 我知道
InfoWindow
类没有click
侦听器,如官方Google Maps API v3参考中所示 。 But there is a content_changed
listener. 但是有一个
content_changed
侦听器。
So currently I am thinking of a "hack" would be something like this: 所以目前我正在考虑“ hack”是这样的:
div
is clicked (a listener via JavaScript of jQuery) div
(通过jQuery JavaScript的侦听器) div
will be changed subtly (add an extra invisible character at the end or something) div
将被巧妙地更改(在结尾处添加一个额外的不可见字符或其他内容) InfoWindow.setContent()
InfoWindow.setContent()
更新内容 content_changed
listener will trigger content_changed
侦听器将触发 InfoWindow.setZIndex()
InfoWindow.setZIndex()
设置更高的z-index Is there a better way to do this? 有一个更好的方法吗?
If you are going to do this... i hope you dont have to many info windows! 如果您要执行此操作...我希望您不必使用许多信息窗口!
But would it not just be simpler to generate an array of all you info windows, then when you div is clicked move that ones z-index higher and the others all lower. 但是,不仅要生成一个包含所有信息窗口的数组,然后单击div时,将那些z-index移到更高,将其他z-index移到更低,这不仅会更简单。 Then you just need to have the object name of the info window to call myInfoWindow.setZIndex().
然后,您只需要具有信息窗口的对象名称即可调用myInfoWindow.setZIndex()。
A little simpler. 简单一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.