Google Maps API V3: How to jump to a specific marker from outside the map?

前端 未结 1 421
借酒劲吻你
借酒劲吻你 2021-02-03 10:52

I have a map with two markers on it.

The initial view of the map only shows one marker, and I want to provide a link next to the map that will move the map to the 2nd m

1条回答
  •  迷失自我
    2021-02-03 11:41

    Use addDomListener to add a click event to the link that will move the map to that marker (you'll also need to add an id to the link tag so you can reference it in code):

    Edit: Set the event in a initialization function:

    
       
     
     
      Second place
      

    0 讨论(0)
提交回复
热议问题