Hi @svenatkins,
The “zoomend” fires after any zoom event (see here). It doesn’t contain any info on markers.
If you want to access all the available markers you could do this by:
oumMap.eachLayer((layer) => {
//do something with layer (=marker)
})
Best Regards,
Daniel
Hi Daniel,
I want to open the Popup of the marker after I flyto to a marker.
The flyto event is triggerd by a slider.
swiper.on('slideChangeTransitionStart', function () {
const lng = document.querySelector('.swiper-slide-active').getAttribute('data-longitude');
const lat = document.querySelector('.swiper-slide-active').getAttribute('data-latitude');
oumMap.flyTo([lat,lng], 18);
});
I don’t understand how to connect the end of the flyto with the layer.
Hallo Daniel,
ich möchte das Popup des Markers öffnen nachdem ich zu ihm geflogen bin.
Das “fliegen” lass ich von einem Slider starten der die Ziel Koordinaten mitgibt.
Leider versteh ich nicht wie ich die Layer Funktion mit der flyto Funktion verknüpfen kann.
Kannst du mir noch einen Tipp in die richtige Richtung geben?
Danke und Grüße.
Hey @svenatkins,
Let’s stick to english so that most people could read along (thanks for the german translation though).
Unfortunately this will not work like you want it to. If you just zoom-in on some coordinates on the map there is no relation to the markers that may (or may not) exist on this specific point.
You need to address the markers directly with a post_id (POPUP_MARKER_ID):
oumMap.eachLayer(function(layer){
if(layer.options.post_id && layer.options.post_id == POPUP_MARKER_ID){
if(!layer._icon) {
oumMap.fitBounds(layer.__parent._bounds);
}else{
oumMap.setView(layer.getLatLng(), 9);
}
layer.openPopup();
}
});
So don’t use the oum.flyTo in your code. Instead use the snippet from above with the correct post_id (POPUP_MARKER_ID).
Best Regards,
Daniel