trigger google maps marker click

前端 未结 2 645
心在旅途
心在旅途 2020-12-24 10:54

I have a google map set up to find the user\'s current location, and center the map at that closest marker to their location. The markers, when clicked, open up an infobox (

2条回答
  •  粉色の甜心
    2020-12-24 11:24

    i see that this question has been sitting for quite awhile, but, just in case, this answer may be helpful: trigger google maps marker click

    The code would look like this:

    var marker = new google.maps.Marker({});
    new google.maps.event.trigger( marker, 'click' );
    

    Good luck!

提交回复
热议问题