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
54
assets/js/swipers.js
Normal file
54
assets/js/swipers.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import Swiper from 'https://cdn.jsdelivr.net/npm/swiper@12/swiper-bundle.min.mjs';
|
||||
|
||||
export function initSwipers(container = document) {
|
||||
const sliders = container.querySelectorAll('.swiper');
|
||||
|
||||
if (sliders.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
sliders.forEach((sliderElement) => {
|
||||
// Éviter de réinitialiser un swiper déjà initialisé
|
||||
if (sliderElement.swiper) {
|
||||
return;
|
||||
}
|
||||
|
||||
const swiper = new Swiper(sliderElement, {
|
||||
// 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: sliderElement.querySelector('.swiper-button-next'),
|
||||
prevEl: sliderElement.querySelector('.swiper-button-prev'),
|
||||
},
|
||||
|
||||
// Pagination
|
||||
pagination: {
|
||||
el: sliderElement.querySelector('.swiper-pagination'),
|
||||
clickable: true,
|
||||
},
|
||||
|
||||
// Keyboard control
|
||||
keyboard: {
|
||||
enabled: true,
|
||||
},
|
||||
|
||||
// Accessibility
|
||||
a11y: {
|
||||
prevSlideMessage: 'Investigation précédente',
|
||||
nextSlideMessage: 'Investigation suivante',
|
||||
paginationBulletMessage: 'Aller à l\'investigation {{index}}',
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue