/******/ (() => { // webpackBootstrap
/*!******************************************!*\
  !*** ./src/dernieres-dynamiques/view.js ***!
  \******************************************/
function swiperCheckBreakpoints() {
  const hasSwiper = dernieresDynamiquesSwiper.__swiper__ === true;

  // if (window.innerWidth < 960 && hasSwiper) {
  // 	dernieresDynamiquesSwiper.destroy(true, true);
  // }
  // if (window.innerWidth >= 960 && !hasSwiper) {
  // 	initiateSwiper();
  // }
}
function initiateSwiper() {
  const currentBlock = document.querySelector(".block-dernieres-dynamiques");
  if (!currentBlock) return;
  const swiperFraction = currentBlock.querySelector(".swiper-pagination-fraction");
  const slides = currentBlock.querySelectorAll(".swiper-slide");
  const slideCount = slides.length;
  swiperFraction.textContent = `Article n°1 sur ${slideCount}`;
  dernieresDynamiquesSwiper = new Swiper(".dernieres-dynamiques-swiper", {
    slidesPerView: 2,
    spaceBetween: 30,
    loop: true,
    grabCursor: true,
    keyboard: {
      enabled: true,
      onlyInViewport: true
    },
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev"
    },
    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
    },
    pagination: {
      el: ".swiper-pagination",
      clickable: true,
      renderBullet: function (index, className) {
        return `<button class="${className}"></button>`;
      }
    },
    breakpoints: {
      // when window width is >= 320px

      // when window width is >= 480px
      320: {
        slidesPerView: 1
      },
      // when window width is >= 640px
      1100: {
        slidesPerView: 2
      }
    },
    on: {
      slideChange: swiper => {
        const slidesCount = swiper?.slides?.length;
        swiperFraction.textContent = `Article n°${swiper.realIndex + 1} sur ${slidesCount}`;
      }
    }
  });
}
window.addEventListener("DOMContentLoaded", event => {
  initiateSwiper();
  swiperCheckBreakpoints();
  window.addEventListener("resize", swiperCheckBreakpoints);
});
/******/ })()
;
//# sourceMappingURL=view.js.map