6

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.

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
user1294249
  • 61
  • 1
  • 2

2 Answers2

6

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.

Sean Mickey
  • 7,618
  • 2
  • 32
  • 58
  • The provided links are broken... they must have been removed – r0m4n Jul 23 '16 at 21:32
  • @r0m4n: Thanks for the heads-up. I will take a look at this later today and update the answer to correct the problem, update the links if possible, and add more detail to the answer, so it's not so link-dependent. – Sean Mickey Jul 25 '16 at 12:22
  • later today in January 2017? ;) – Ryan Vettese Jan 12 '17 at 05:02
  • 1
    @RyanVeteze: I made that promise, got busy at work, and it must have flown completely out of my head. But since you gave me a little poke, I (finally) dove in and fixed the busted links. Thanks for the ping - I feel better that I kept my word eventually ~ – Sean Mickey Jan 13 '17 at 08:42
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.

edigu
  • 9,878
  • 5
  • 57
  • 80