Simulate a click in a Google Map

后端 未结 1 410
北海茫月
北海茫月 2020-12-16 14:27

I\'m trying to simulate a user click on a Google Map, using API v3, after I geolocate their position when they write down their address.

I used to do:



        
相关标签:
1条回答
  • 2020-12-16 15:13

    The map object's 'click' event takes a google.maps.MouseEvent object as parameter:

    var mev = {
      stop: null,
      latLng: new google.maps.LatLng(40.0,-90.0)
    }
    
    google.maps.event.trigger(map, 'click', mev);
    

    Live example here

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