Changing the info window when using Google directions

I am currently using the googles API, it works fine and applies 8 waypoints to my map using this line of code:

directionsDisplay.setDirections(response); 

However, each mark on clicking shows an information window with the waypoint address. Is there any way to change the contents of these info windows?

Thanks, James.

+4
source share
1 answer

Use the {suppressInfoWindows: true} parameter for DirectionsRenderer , add clicks to the viewer map to display what you want in InfoWindow. You can use {suppressMarkers: true} and create your own markers so that you can attach a click listener to the marker.

Custom markers example (more complicated than you need, but it shows how to create custom markers with info windows)

Custom marker and waypoint example

+4
source

Source: https://habr.com/ru/post/1481261/


All Articles