index-main/assets/js/home-investigations-slider.js
Julie Blanc 1ea9f36aa1
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s
add slider
2026-01-27 19:58:53 +01:00

47 lines
1 KiB
JavaScript

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}}',
},
});
}