Yes, maybe ... there are several ways to do this
One way is to use OverlayView - see a demo here Show / hide overlays
From the documentation :
- Define a custom object prototype for the new google.maps.OverlayView () instance. This will effectively βsubclassβ the overlay class.
- Create a constructor for the custom overlay and set any initialization parameters for the custom properties inside this constructor.
- Embed the onAdd () method in your prototype and attach the overlay to the map. OverlayView.onAdd () will be called when the map is ready to attach the overlay.
- Embed the draw () method in your prototype and handle the visual display of your object. OverlayView.draw () is called when the object is first displayed.
- You must also implement the onRemove () method to clear any elements added to the overlay.
After that, you will need to add eventListener to the map for the click event, for example, to activate this OverlayView, here is an example of how to add clickListener click on the map <a2>
source share