1(function($){ 2 3 4 $(document).ready(function (){ 5 6 7 let allCarousels = $(document).find('.w1-carousel-section'); 8 9 allCarousels.each(function(){ 10 11 let slickPagingInfo = $(this).find('.carousel-pagingInfo p'); 12 let slickCarousel = $(this).find('.carousel-slideshow'); 13 let breakpoint = 992; 14 15 /** 16 * 17 * THIS FUNCTION 18 * creates a Slick Slider PAGINATION where, 19 * while in Desktop mode, looks like this: 1-3 / totalSlides, 20 * and while in Mobile mode looks like this: 1 / totalSlides 21 */ 22 23 let isAutoplayActive = true; 24 if(!slickCarousel.hasClass('active_autoplay')){ 25 isAutoplayActive = false; 26 }; 27 28 29 $(slickCarousel).on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) { 30 //currentSlide is undefined on init -- set it to 0 in this case (currentSlide is 0 based) 31 if(!slick.$dots){ 32 return; 33 } 34 35 if(currentSlide == undefined){ 36 currentSlide = 1; 37 }else{ 38 currentSlide++; 39 } 40 41 let slidesToShow = slick.slickGetOption('slidesToShow'); 42 let currentSlickSlide = parseInt(currentSlide); 43 let totalSlickSlides = parseInt(slick.slideCount); 44 45 46 if(slidesToShow > 1 && slidesToShow < totalSlickSlides ){ 47 if(!slick.infinite){ 48 /** 49 * The lastCurrentSlide value is first calculated, 50 * and then adjusted to never exceed the total amount of slides. 51 * */ 52 let lastCurrentSlide = currentSlickSlide + slidesToShow -1; 53 54 if(lastCurrentSlide > totalSlickSlides){ 55 lastCurrentSlide = totalSlickSlides; 56 } 57 58 /** 59 * When the amount of slides is not a multiple of the slides 60 * being shown, the slider will only scroll for the number of slides remaining. 61 * */ 62 if( currentSlickSlide > (lastCurrentSlide - slidesToShow + 1)){ 63 currentSlickSlide = (lastCurrentSlide - slidesToShow + 1); 64 } 65 66 $(slickPagingInfo).text(currentSlickSlide+' - '+lastCurrentSlide+ ' / ' + totalSlickSlides); 67 } 68 }else if(slidesToShow == 1){ 69 $(slickPagingInfo).text(currentSlickSlide+ ' / ' + totalSlickSlides); 70 }else{ 71 return 72 } 73 74 75 76 }); 77 78 $(slickCarousel).slick({ 79 infinite: false, // If it has to be set to 'true' the pagination lastCurrentSlide value has to be corrected! (and vice versa) 80 slidesToShow: 1, 81 slidesToScroll: 1, 82 autoplay: isAutoplayActive, 83 dots: true, 84 mobileFirst: true, 85 responsive:[ 86 { 87 breakpoint: breakpoint, 88 settings: { 89 slidesToShow: 3, 90 slidesToScroll: 3, // If it is set to '1' the pagination currentSlickSlide value has to be corrected! (and vice versa) 91 infinite: true, 92 } 93 } 94 ] 95 }); 96 97 $(document).find('.w1-carousel').css('opacity', 1); 98 99 }); 100 101 }); 102 103} )(jQuery); 104
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.