EDIT : I have recreated the issue on this website, if you want to check : http://leafletdev1.id-interactive.info/
I am truely sorry, i saw a lot of posts that looks like my problem, but none of them are working as I think it is not exactly related on the same subject. I am pretty sure my issue is somehow linked to this : jQuery Click Working Once, not Twice, but... I am a real newbie in ajax, and I can't really understand everything of what is going on here...
I have a wordpress website that is using the freemium version of the plugin Leaflet Maps Marker v3.12.4. Here, I am displaying a map, with popups that open when I click the marker linked to them :
What I am trying to achieve, is that when I click on a "Bouton d'action" button, it click the marker in order to open the popup. And it is actually working, except that when I move on the map, zoom, dezoom, or do any actual action, the clicks won't work anymore, and no more popups will open.
Here is my code :
$(document).ready(function () {
$('.marker1').click(function () {
let d = 250;
setTimeout(function () {
let markersDOM = $('.leaflet-marker-pane img');
let marker = null;
let markerTitle = null;
for (var i = 0; i < markersDOM.length; i++) {
markerTitle = markersDOM[i];
marker = markersDOM[i].getAttribute("title");
if (marker === "marker1") {
$(markerTitle).click();
}
}
}, d);
});
});
Do you know what is happening here ? I am a little lost...
Thanks a lot for reading this.