最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Google maps v3 info window opening outside map viewport - Stack Overflow

programmeradmin1浏览0评论

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.

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.

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.

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.

Share Improve this question edited Mar 27, 2012 at 2:51 Erik Philips 54.7k11 gold badges131 silver badges156 bronze badges asked Mar 26, 2012 at 23:50 user1294249user1294249 611 silver badge2 bronze badges 1
  • Are you referring to Google's default info window or a custom info window? – Erik Philips Commented Mar 27, 2012 at 2:52
Add a ment  | 

2 Answers 2

Reset to default 6

No, you can't open google's default infowindows in a different direction since you don't implement your own infowindow class. But you can disable auto-pannnig simply passing TRUE to disableAutoPan property of InfoWindowOptions object like documentation said.

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.

发布评论

评论列表(0)

  1. 暂无评论