user2254372
user2254372

Reputation: 121

Changing the infoWindow when using google directions

I am currently using googles directions API, it works fine, and plots 8 waypoints onto my map with the route using this line of code:

    directionsDisplay.setDirections(response);

However, each marks, when clicked, shows up an info window with the address of the waypoint. Is there a way to change the content of these infowindows?

Thanks in advance, James.

Upvotes: 5

Views: 3055

Answers (1)

geocodezip
geocodezip

Reputation: 161334

Use the {suppressInfoWindows: true} option to the DirectionsRenderer, add a click listener to the map to display what you want in an InfoWindow. You may want to use {suppressMarkers:true} and create your own Markers so you can attach the click listener to the marker.

Example with custom markers (more complicated than you need, but it shows how to create custom markers with infowindows)

Example with custom markers and a waypoint

Upvotes: 4

Related Questions