document.addEventListener("DOMContentLoaded", function () {
	const currentBlock = document.querySelector(".block-revues-precedentes");
	if (!currentBlock) return;

	const swiperFraction = currentBlock.querySelector(
		".swiper-pagination-fraction",
	);

	const slides = currentBlock.querySelectorAll(".swiper-slide");
	const slideCount = slides.length;

	new Swiper(".revues-precedentes-swiper", {
		slidesPerView: 1,
		spaceBetween: 30,
		loop: true,
		grabCursor: true,
		pagination: {
			el: ".swiper-pagination",
			clickable: true,
		},
		mousewheel: {
			enabled: true,
			forceToAxis: true, // Force le scroll dans l'axe du slider
			sensitivity: 1, // Sensibilité du scroll (1 = normal)
			releaseOnEdges: false, // Continue le scroll même aux bords
		},
		keyboard: {
			enabled: true,
			onlyInViewport: true,
		},
		// Activation du swipe/glissement tactile
		// touchEventsTarget: "container",
		// simulateTouch: true,
		// allowTouchMove: true,
		navigation: {
			nextEl: ".swiper-button-next",
			prevEl: ".swiper-button-prev",
		},

		// on: {
		// 	slideChange: (swiper) => {
		// 		const slidesCount = swiper?.slides?.length;
		// 		swiperFraction.textContent = `Revue n°${
		// 			swiper.realIndex + 1
		// 		} sur ${slidesCount}`;
		// 	},
		// },
	});
});
