1(function ($, window, document) { 2 3 const allSwiper = $('.news-list-swiper .ce-news-cards'); 4 5 allSwiper.each(function () { 6 7 const element = this; 8 9 let swiperEnabled; 10 let swiper; 11 12 const swiperWrapper = $(this).find('.swiper-wrapper').get(0); 13 14 const checkSwiperWidth = function() { 15 return swiperWrapper.scrollWidth > swiperWrapper.offsetWidth 16 } 17 18 const checkSwiper = function() { 19 if(!swiperEnabled && checkSwiperWidth()) { 20 initializeSwiper(); 21 swiperEnabled = true; 22 } 23 if(swiperEnabled && !checkSwiperWidth()) { 24 swiper.destroy(); 25 swiperEnabled = false; 26 } 27 } 28 29 const initializeSwiper = function() { 30 31 const paginationIcon = $(element).find('.swiper-dots'); 32 33 swiper = new Swiper(element, { 34 slidesPerView: 'auto', 35 36 direction: 'horizontal', 37 loop: true, 38 // parallax: true, 39 keyboard: { 40 enabled: true, 41 onlyInViewport: true, 42 }, 43 navigation: { 44 prevEl: $(element).parent().find('.swiper-prev')[0], 45 nextEl: $(element).parent().find('.swiper-next')[0], 46 }, 47 pagination: { 48 el: $(element).parent().find('.swiper-pagination')[0], 49 clickable: true, 50 dynamicBullets: false, 51 renderBullet: function () { 52 return `<span class="swiper-pagination-bullet"><i class="custom-icon icon-pagination" aria-hidden="true"><svg><use width="100%" height="100%" xlink:href="${paginationIcon.data('icon')}"></use></svg></i></span>`; 53 }, 54 }, 55 }); 56 } 57 58 $(window).on('resize', function () { 59 checkSwiper(); 60 }); 61 62 checkSwiper(); 63 64 }); 65 66})(jQuery, window, document);
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.