Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google maps v3 info window opening outside map viewport

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.

like image 950
user1294249 Avatar asked Mar 26 '12 23:03

user1294249


2 Answers

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.

like image 150
edigu Avatar answered Oct 26 '22 01:10

edigu


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.

like image 37
Sean Mickey Avatar answered Oct 26 '22 02:10

Sean Mickey