Hi @nikosillo,
Try this again downgrading to the last working version of the plugin. If your functionality is working. Provide the Code which you have added to run this functionality.
It works perfectly with the previous version, 1.12.1.
I attach another page with this version where it works correctly.
The button is from The Plus Elementor, which allows me to insert a shortcode for asign a class and data.postid. The function calls a popup leaflet map.
// Listen for the event triggered when Travelers' Map is loaded
document.addEventListener('cttm_map_loaded', function (e) {
//Find all the buttons and add a click event on each
document.querySelectorAll('.button-link-wrap').forEach((a) => {
//Get the post id "data-" attribute on the button
const postID = a.dataset.postid;
a.addEventListener('click', function (event) {
//console.log('link assigned?');
findAndOpenMarker(postID);
});
function findAndOpenMarker(postID) {
// We only have one map, so we will use cttm_markers[0]. If you want to work with multiple maps, you will have to add a second loop.
for (let i = 0; i < cttm_markers[0].length; i++) {
// If the marker post ID is the same as the button we clicked AND if it's the main marker.
if (
cttm_markers[0][i].additionalData.postid == postID &&
cttm_markers[0][i].additionalData.multipleMarkersIndex == 0
) {
// If the icon is not on the map, it means it's inside a cluster,
// so you have to use .spiderfy() on the parent cluster to open the popup.
// This will save you a lot of time understanding why it's not working ^^'
if (!cttm_markers[0][i]._icon) {
cttm_markers[0][i].__parent.spiderfy();
}
// Open the marker popup
//console.log('is modal open or not?');
cttm_markers[0][i].openPopup();
// Add a nice transition
cttm_map[0].panTo(cttm_markers[0][i].getLatLng(), {
animate: true,
duration: 1,
});
}
}
}
});
}, false);
The “Visit” button “Map” works in the same way, outside the popup.
This other page shows it working fine with the previous version.
https://alpujarras-qr.legadoandalusi.es/lanjaron/
Maybe it’s silly, my knowledge is limited, but it worked. There’s probably something I need to change…
Thanks