add slider
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s

This commit is contained in:
Julie Blanc 2026-01-27 19:58:53 +01:00
parent 8a4f9d6b64
commit 1ea9f36aa1
9 changed files with 249 additions and 36 deletions

View file

@ -0,0 +1,47 @@
import Swiper from 'https://cdn.jsdelivr.net/npm/swiper@12/swiper-bundle.min.mjs';
export function initHomeInvestigationsSlider() {
const slider = document.querySelector('.home-investigations-slider');
if (!slider) {
return;
}
const swiper = new Swiper('.home-investigations-slider', {
// Optional parameters
slidesPerView: 1,
spaceBetween: 20,
speed: 600,
// Touch/Swipe settings
touchRatio: 1,
touchAngle: 45,
grabCursor: true,
simulateTouch: true,
allowTouchMove: true,
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// Pagination
pagination: {
el: '.swiper-pagination',
clickable: true,
},
// Keyboard control
keyboard: {
enabled: true,
},
// Accessibility
a11y: {
prevSlideMessage: 'Investigation précédente',
nextSlideMessage: 'Investigation suivante',
paginationBulletMessage: 'Aller à l\'investigation {{index}}',
},
});
}

View file

@ -7,6 +7,7 @@ import { themeToggle } from './themeToggle.js';
import { initHeroSlider } from './hero-slider.js';
import { playVideo } from './hero-video.js';
import { initDropdowns } from './dropdown.js';
import { initHomeInvestigationsSlider } from './home-investigations-slider.js';
const responsiveMedium = 1080;
const responsiveSmall = 768;
@ -24,4 +25,5 @@ window.onload = async function () {
initHeroSlider();
playVideo();
initDropdowns(responsiveSmall);
initHomeInvestigationsSlider();
}