php et js point carte cliquable
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user