feat: add map-to-card flash highlight on marker click

This commit is contained in:
2026-06-20 12:47:51 +02:00
parent 9365f46440
commit a398bcb737
+6 -1
View File
@@ -321,7 +321,12 @@ tripMap.on('load', function () {
el.addEventListener('mouseleave', function () { popup.remove(); });
el.addEventListener('click', function () {
var card = document.getElementById('entry-' + entry.slug);
if (card) card.scrollIntoView({ behavior: 'smooth', block: 'center' });
if (!card) return;
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
setTimeout(function () {
card.classList.add('is-highlighted');
setTimeout(function () { card.classList.remove('is-highlighted'); }, 700);
}, 350);
});
new maplibregl.Marker({ element: el }).setLngLat(lngLat).addTo(tripMap);