Wednesday 19 October 2011

Avoid InfoWindow from shifting Google Maps

It's kind of inconsistent in some cases that Google InfoWindow would shift the map while panning. That's a huge user experience if this map behaviour is not your intention. There a couple ways to resolve it, either close the InfoWindow when panning the map way far causing it invisible, or set the proper value to an attribute of InfoWindow, which I believe it is the easiest and most solid solution. Here is the code snippet for the 2nd solution.

 
var infoWin = new google.maps.InfoWindow({disableAutoPan: true});
 

No comments:

Post a Comment