refactoring file
This commit is contained in:
parent
4dabdc6468
commit
74d372a735
|
|
@ -1,7 +1,4 @@
|
|||
window.addEventListener("DOMContentLoaded", (event) => {
|
||||
const cardThematiques = document.querySelectorAll(".swiper-slide .card-thematique");
|
||||
|
||||
function swiperCheckBreakpoints() {
|
||||
function swiperCheckBreakpoints() {
|
||||
const hasSwiper = thematiquesSwiper.__swiper__ === true;
|
||||
|
||||
if (window.innerWidth < 960 && hasSwiper) {
|
||||
|
|
@ -10,9 +7,13 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
|||
if (window.innerWidth >= 960 && !hasSwiper) {
|
||||
initiateSwiper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initiateSwiper() {
|
||||
const cardThematiques = document.querySelectorAll(".swiper-slide .card-thematique");
|
||||
|
||||
if (!Swiper) return;
|
||||
|
||||
function initiateSwiper() {
|
||||
thematiquesSwiper = new Swiper(".swiper-container", {
|
||||
grabCursor: false,
|
||||
slidesPerView: 3,
|
||||
|
|
@ -57,7 +58,8 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
|||
},
|
||||
// a11y: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
window.addEventListener("DOMContentLoaded", (event) => {
|
||||
initiateSwiper();
|
||||
swiperCheckBreakpoints();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user