Google Maps: How to prevent InfoWindow from shifting the map

前端 未结 2 1235
我在风中等你
我在风中等你 2020-12-09 08:52

Using Google Maps API v3.

I noticed that if I have a map marker near the edge of my map border ... that if I click the marker icon so that the InfoWindow will displa

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-09 09:08

    Since you are using v3, you can simply prevent the infoWindow from shifting the map with the disableAutoPan option, as in the following example (API Reference):

    
     
     
        
       Google Maps disableAutoPan Demo 
        
     
     
    
       

    Screenshot:

    disableAutoPan

提交回复
热议问题