[Resuelto] Focus on map marker corresponding to post in View results
Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.
Problem:
A View lists posts, and also displays the same results as markers on a map. How to click on a post result and have the map focus on the corresponding marker?
Solution:
You can insert a button for each post into the View results with a required attributes that will focus the map on the marker, like so:
<button class="js-wpv-addon-maps-focus-map" data-map="map-name" data-marker="marker-[wpv-post-id]">
Focus on marker</button>
This support ticket is created hace 6 años, 1 mes. 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.
"when you click that it will lead to the map marker thats next to it"
The archive lists posts, and displays the same results as markers on a map.
Clicking either the post or the marker would normally take you to the single post (where you might also display a map with the single marker).
What is it you want to do?
If a user clicks an icon on a post in the list of results, it should, what?, stay on the same page, displaying the same map, but "lead to the map marker", which means what exactly?
Sorry for confusion.
on the archieve page i will create a map icon.
clicking that i want it to lead to the marker on the map on the SAME page.
clicking the title of course it goes to the detail page .
"lead to the marker" is the bit I'm struggling with.
You mean the related marker should be highlighted when clicking the icon, or did you have something else in mind, such as when there are a lot of results, clicking the map icon scrolls back to where the map is shown?
The info window that appears when you click on the marker itself is initially closed.
Let me check with the developer if he can short-cut me towards a JS event that could be used to simulate the click that would open the info window (otherwise it will likely mean a feature request).
I should hear from him in the morning, and I'll update you.
Nope, unless I've misunderstood what you have done already, the code doesn't require any editing, just add it to the custom JS section of your View that displays the map and list of results.