carte points en rouge quand sur page site correspondant
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -202,7 +202,7 @@
|
||||
|
||||
});
|
||||
|
||||
//////// end header ////////////
|
||||
//////// end header ////////////
|
||||
|
||||
|
||||
|
||||
@@ -444,88 +444,69 @@
|
||||
});
|
||||
|
||||
|
||||
///////////// carte sticky node site ///////////////////
|
||||
// window.addEventListener('scroll', function() {
|
||||
// const mapContainer = document.getElementById('sites-map-container');
|
||||
// const header = document.querySelector('header'); // Sélectionnez votre header
|
||||
|
||||
// const headerHeight = header.offsetHeight; // Calculer la hauteur du header
|
||||
// const scrollPosition = window.scrollY; // Obtenir la position actuelle du scroll
|
||||
// console.log('Hauteur dynamique du header:', headerHeight);
|
||||
|
||||
// if (scrollPosition >= headerHeight - 350 ) {
|
||||
// mapContainer.classList.add('fixed');
|
||||
// mapContainer.style.position = 'fixed';
|
||||
// mapContainer.style.top = headerHeight + 350 ; // Fixé en haut une fois passé le header
|
||||
// } else {
|
||||
// mapContainer.classList.remove('fixed');
|
||||
// mapContainer.style.position = 'static'; // Retour à la position initiale
|
||||
// }
|
||||
// });
|
||||
|
||||
//////////////// lightbox galerie image page site////////////////////////
|
||||
|
||||
// Sélectionne uniquement les images à l'intérieur de '.paragraph--type--site-diapo'
|
||||
// Sélectionne uniquement les images à l'intérieur de '.paragraph--type--site-diapo'
|
||||
let images = document.querySelectorAll('.paragraph--type--site-diapo .lightbox-trigger');
|
||||
let currentIndex;
|
||||
// Sélectionne uniquement les images à l'intérieur de '.paragraph--type--site-diapo'
|
||||
let images = document.querySelectorAll('.paragraph--type--site-diapo .lightbox-trigger');
|
||||
let currentIndex;
|
||||
|
||||
// Créer le lightbox et ses éléments
|
||||
const lightbox = document.createElement('div');
|
||||
lightbox.id = 'lightbox';
|
||||
lightbox.classList.add('lightbox');
|
||||
document.body.appendChild(lightbox);
|
||||
// Créer le lightbox et ses éléments
|
||||
const lightbox = document.createElement('div');
|
||||
lightbox.id = 'lightbox';
|
||||
lightbox.classList.add('lightbox');
|
||||
document.body.appendChild(lightbox);
|
||||
|
||||
const img = document.createElement('img');
|
||||
lightbox.appendChild(img);
|
||||
const img = document.createElement('img');
|
||||
lightbox.appendChild(img);
|
||||
|
||||
const closeBtn = document.createElement('span');
|
||||
closeBtn.classList.add('close');
|
||||
closeBtn.innerHTML = '×';
|
||||
lightbox.appendChild(closeBtn);
|
||||
const closeBtn = document.createElement('span');
|
||||
closeBtn.classList.add('close');
|
||||
closeBtn.innerHTML = '×';
|
||||
lightbox.appendChild(closeBtn);
|
||||
|
||||
const prevBtn = document.createElement('a');
|
||||
prevBtn.classList.add('prev');
|
||||
prevBtn.innerHTML = '❮';
|
||||
lightbox.appendChild(prevBtn);
|
||||
const prevBtn = document.createElement('a');
|
||||
prevBtn.classList.add('prev');
|
||||
prevBtn.innerHTML = '❮';
|
||||
lightbox.appendChild(prevBtn);
|
||||
|
||||
const nextBtn = document.createElement('a');
|
||||
nextBtn.classList.add('next');
|
||||
nextBtn.innerHTML = '❯';
|
||||
lightbox.appendChild(nextBtn);
|
||||
const nextBtn = document.createElement('a');
|
||||
nextBtn.classList.add('next');
|
||||
nextBtn.innerHTML = '❯';
|
||||
lightbox.appendChild(nextBtn);
|
||||
|
||||
// Ajouter un écouteur d'événement sur chaque image pour ouvrir le lightbox
|
||||
images.forEach((image, index) => {
|
||||
image.addEventListener('click', () => {
|
||||
lightbox.style.display = 'flex';
|
||||
img.src = image.src;
|
||||
currentIndex = index;
|
||||
// Ajouter un écouteur d'événement sur chaque image pour ouvrir le lightbox
|
||||
images.forEach((image, index) => {
|
||||
image.addEventListener('click', () => {
|
||||
lightbox.style.display = 'flex';
|
||||
img.src = image.src;
|
||||
currentIndex = index;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Fermer le lightbox
|
||||
closeBtn.addEventListener('click', () => {
|
||||
lightbox.style.display = 'none';
|
||||
});
|
||||
|
||||
// Naviguer vers l'image précédente
|
||||
prevBtn.addEventListener('click', () => {
|
||||
currentIndex = (currentIndex > 0) ? currentIndex - 1 : images.length - 1;
|
||||
img.src = images[currentIndex].src;
|
||||
});
|
||||
|
||||
// Naviguer vers l'image suivante
|
||||
nextBtn.addEventListener('click', () => {
|
||||
currentIndex = (currentIndex < images.length - 1) ? currentIndex + 1 : 0;
|
||||
img.src = images[currentIndex].src;
|
||||
});
|
||||
|
||||
// Fermer le lightbox quand on clique en dehors de l'image
|
||||
lightbox.addEventListener('click', (e) => {
|
||||
if (e.target === lightbox) {
|
||||
// Fermer le lightbox
|
||||
closeBtn.addEventListener('click', () => {
|
||||
lightbox.style.display = 'none';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Naviguer vers l'image précédente
|
||||
prevBtn.addEventListener('click', () => {
|
||||
currentIndex = (currentIndex > 0) ? currentIndex - 1 : images.length - 1;
|
||||
img.src = images[currentIndex].src;
|
||||
});
|
||||
|
||||
// Naviguer vers l'image suivante
|
||||
nextBtn.addEventListener('click', () => {
|
||||
currentIndex = (currentIndex < images.length - 1) ? currentIndex + 1 : 0;
|
||||
img.src = images[currentIndex].src;
|
||||
});
|
||||
|
||||
// Fermer le lightbox quand on clique en dehors de l'image
|
||||
lightbox.addEventListener('click', (e) => {
|
||||
if (e.target === lightbox) {
|
||||
lightbox.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user