Skip to content

Instantly share code, notes, and snippets.

@spyrosvl
Created November 3, 2017 12:08
Show Gist options
  • Save spyrosvl/903746ce14fb2a0a333c2141d63265fe to your computer and use it in GitHub Desktop.
Save spyrosvl/903746ce14fb2a0a333c2141d63265fe to your computer and use it in GitHub Desktop.
// The function to trigger the marker click, 'id' is the reference index to the 'markers' array.
function markerClick(id){
google.maps.event.trigger(markers[id], 'click');
}
// this should be on the loop creating the markers
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.open(map, marker);
}
})(marker, i));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment