1/*(function ($) { 2 $(function () { 3 4 $('.articles-swiper').each(function () { 5 var el = this; 6 var $el = $(el); 7 var slideCount = $el.find('.swiper-slide').length; 8 9 // Init Swiper 10 var swiper = new Swiper('#' + el.id, { 11 loop: slideCount > 1, 12 slidesPerView: 'auto', // largeur gérée par CSS (var --slide-width) 13 centeredSlides: true, 14 spaceBetween: 24, 15 autoplay: { 16 delay: 7000, 17 disableOnInteraction: false 18 }, 19 pagination: { 20 el: '#' + el.id + ' .swiper-pagination', 21 clickable: true 22 }, 23 navigation: { 24 nextEl: '#' + el.id + ' .swiper-button-next', 25 prevEl: '#' + el.id + ' .swiper-button-prev' 26 }, 27 watchOverflow: true // évite les bugs si peu de slides 28 }); 29 }); 30 31 $('.articles-filter-form select[name="articles_cat"]').on('change', function () { 32 $(this).closest('form').submit(); 33 }); 34 35 }); 36})(jQuery);*/ 37 38jQuery(function($) { 39 function initSwiper() { 40 var $container = $('.articles-swiper'); 41 var $wrapper = $container.find('.swiper-wrapper'); 42 var totalSlides = $wrapper.find('.swiper-slide').length; 43 var slideWidth = 295; // correspond au max-width de .swiper-slide 44 var spaceBetween = 24; 45 46 // Estimer combien de slides sont visibles à l'écran actuel 47 var containerWidth = $container.width(); 48 var visibleSlides = Math.floor(containerWidth / (slideWidth + spaceBetween)); 49 50 // Clonage si pas assez de slides pour faire une boucle 51 if (totalSlides < visibleSlides * 2) { 52 for (let i = 0; i < (visibleSlides * 2 - totalSlides); i++) { 53 $wrapper.append($wrapper.find('.swiper-slide').eq(i % totalSlides).clone()); 54 } 55 totalSlides = $wrapper.find('.swiper-slide').length; // mettre à jour 56 } 57 58 // Swiper init 59 var swiper = new Swiper($container[0], { 60 loop: true, 61 slidesPerView: 'auto', 62 spaceBetween: spaceBetween, 63 autoplay: { 64 delay: 5000, 65 disableOnInteraction: false 66 }, 67 navigation: { 68 nextEl: '.articles-swiper .swiper-button-next', 69 prevEl: '.articles-swiper .swiper-button-prev' 70 }, 71 // Pas de pagination ici, elle est désactivée 72 }); 73 74 setTimeout(() => swiper.update(), 100); 75 } 76 77 initSwiper(); 78 79 $('.articles-filter-form select[name="articles_cat"]').on('change', function () { 80 $(this).closest('form').submit(); 81 }); 82});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.