How can I trigger action by a map marker click without editing events-manager.js
-
I have my locations page set to show a list of locations and a map with markers for all off these locations.
I’d like it so that when a marker is clicked, I can cause that to trigger something off-map (in this case I’d like it to highlight the container of the relevant location from the list via JS).
Looking here: https://developers.google.com/maps/documentation/javascript/events I can see how that is done but it looks like I’d need to directly edit event-manager.js to do so. Obviously this would break when updating the plugin. Is there a way I can define what happens on clicking a marker in a separate JS file of my own?
... marker.addListener("click", () => { console.log('success'); });
Doing something like this in my efforts so far show problems with “marker” being undefined since it’s outside of the correct scope.
- The topic ‘How can I trigger action by a map marker click without editing events-manager.js’ is closed to new replies.