php et js point carte cliquable

This commit is contained in:
2024-11-07 21:43:28 +01:00
parent 7f5db774d6
commit ea811fccb5
2 changed files with 15 additions and 2 deletions

View File

@@ -101,3 +101,14 @@ if (pageIdMatch) {
const matchingCircle = document.querySelector(`#site-${pageId} circle`);
if (matchingCircle) matchingCircle.setAttribute('fill', 'red');
}
// Écouter les événements de clic sur le SVG
svgElement.addEventListener('click', function(event) {
if (event.target.tagName === 'circle' && event.target.classList.contains('site-link')) {
const targetUrl = event.target.getAttribute('data-url'); // Récupérer l'URL de redirection
if (targetUrl) {
window.location.href = targetUrl; // Rediriger vers l'URL cible
}
}
});