Monday, 16 November 2015

gmap js, google map javascript, stop InfoWindow to move map center


if you call:

 infoWindow.open(map, marker);

The map will move center to try to show the new infoWindow.


if you do this:


            infoWindow.setPosition(latLng);
            infoWindow.open(ctrler.map);

this will stop the moving but it will not be able to show the mark

to solve this, you can:

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

disableAutoPan:true solve the issue.




http://stackoverflow.com/questions/2488999/google-maps-how-to-prevent-infowindow-from-shifting-the-map




No comments:

Post a comment