harmonisation des styles
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s
This commit is contained in:
parent
9ead1c51f4
commit
b3f985a41b
30 changed files with 1601 additions and 465 deletions
|
|
@ -1,16 +1,35 @@
|
|||
|
||||
import { initSwipers } from './swipers.js';
|
||||
|
||||
export function report(responsiveSmall) {
|
||||
if (document.body.dataset.template === 'report') {
|
||||
console.log('report');
|
||||
|
||||
// Initialiser tous les sliders et swipers de la page
|
||||
initSliderBeforeAfter();
|
||||
initSwipers();
|
||||
|
||||
// Ne fonctionne que pour les écrans plus grands que responsiveSmall
|
||||
if (window.matchMedia(responsiveSmall).matches) {
|
||||
return;
|
||||
}
|
||||
|
||||
initMediaDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function initSliderBeforeAfter(container = document){
|
||||
const slidersBeforeAfter = container.querySelectorAll('.slider-before-after');
|
||||
slidersBeforeAfter.forEach(function (sliderContainer, index) {
|
||||
const sliderInput = sliderContainer.querySelector('.slider');
|
||||
if (sliderInput) {
|
||||
sliderInput.addEventListener('input', (e) => {
|
||||
console.log('slider value:', e.target.value);
|
||||
sliderContainer.style.setProperty('--position', `${e.target.value}%`);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initMediaDisplay() {
|
||||
const reportMedias = document.querySelector('#report__medias');
|
||||
if (!reportMedias) return;
|
||||
|
|
@ -115,6 +134,10 @@ function initMediaDisplay() {
|
|||
// Ajouter le nouveau media
|
||||
reportMedias.appendChild(mediaData.media.cloneNode(true));
|
||||
currentMediaId = mediaId;
|
||||
|
||||
// Réinitialiser les sliders et swipers dans le media nouvellement inséré
|
||||
initSliderBeforeAfter(reportMedias);
|
||||
initSwipers(reportMedias);
|
||||
}
|
||||
} else {
|
||||
// Aucune ancre n'a encore franchi la ligne, vider le conteneur
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue