Skip Navigation

[Resuelto] How would I set a click listener on each marker

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem: I would like to know how to set a click listener on each Marker.

Solution: You can access the Map Marker objects in JavaScript:

WPViews.view_addon_maps.markers['yourMapID'].

Here's a simple click handler example on a Marker object:
https://developers.google.com/maps/documentation/javascript/examples/event-simple

This support ticket is created hace 6 años, 7 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por Christian Cox hace 6 años, 7 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#729188

I have a map with multiple markers, all of them are custom posts I have created. e.g.
enlace oculto

Each has an address added using the Google Maps API,
enlace oculto

How would I set a click listener on each marker, which would allow me to get the id of the post associated to that marker and execute some javascript function?

We are trying to show the post Body of each post when the corresponding marker is clicked.

What is the link to your site?
enlace oculto

#729222
Screen Shot 2018-04-24 at 16.51.41.png

this is a screenshot of the desired output.

#730421

Hi, we don't offer much support for this level of customization, so you'll be mostly on your own here. With that being said, you can access the Map Marker objects in JavaScript at WPViews.view_addon_maps.markers['yourMapID'].
Here's a simple click handler example on a Marker object:
https://developers.google.com/maps/documentation/javascript/examples/event-simple