Google会在地图视口外部打开v3信息窗口 [英] Google maps v3 info window opening outside map viewport

查看:106
本文介绍了Google会在地图视口外部打开v3信息窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在地图视口顶部附近单击标记,则infowindow将加载到可查看区域之外,并且必须拖动地图以查看信息窗口内容。

If a marker is clicked near the top of the map viewport, the infowindow loads outside the viewable area and the map must be dragged to see infowindow content.

理想情况下,我不希望地图自动平移。有没有办法在不同的方向加载信息窗口,例如如果标记位于视口顶部以向下显示infowindow。

Ideally I don't want the map to auto pan. Is there a way to load the infowindow in a different direction, e.g. if the marker is at the top of the viewport to display the infowindow in a downward direction.

推荐答案

有一个例子用于加入Google Maps JavaScript API v3 代码示例,转移到GitHub,命名为: SmartInfoWindow 。它完全符合您的描述。检查底层代码,这应该让你朝着正确的方向前进。

There is an example that used to be part of the Google Maps JavaScript API v3 Code Samples, that has moved over to GitHub, named: SmartInfoWindow. It does exactly what you are describing. Check into the underlying code and that should get you going in the right direction.

这篇关于Google会在地图视口外部打开v3信息窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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