// Handler for .ready() called. $(function() { // Slick Slider settings (onderste carousel) $slick_slider = $('.poc-slider, .poc-slider-2'); settings = { slidesToShow: 2, slidesToScroll: 1, centerMode: true, centerPadding: '0', swipeToSlide: true, touchMove: true, autoplay: true, infinite: true, speed: 800, pauseOnFocus: true, pauseOnHover: true, mobileFirst: true, variableWidth: true, zIndex: 10, rows: 1, initialSlide: 0, autoplaySpeed: 5000, responsive: [ { breakpoint: 1368, settings: "unslick" }, { breakpoint: 0, settings: { rows: 1, } } ] }; $slick_slider.slick(settings); // reslick only if it's not slick() $(window).on('resize', function() { if ($(window).width() > 1367) { if ($slick_slider.hasClass('slick-initialized')) { $slick_slider.slick('unslick'); } return; } if (!$slick_slider.hasClass('slick-initialized')) { return $slick_slider.slick(settings); } }); // Slick in multiple tabs $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { $('.slick-slider').resize(); }); // Activate PoC slider $('#carousel-nav-test a').click(function (e) { e.preventDefault(); $(this).tab('show'); }); $('#carousel-nav-test a:first').tab('show'); // Fix snapback issue when resizing $('.slick-slider').on('setPosition', function(event, slick, currentSlide, nextSlide) { var slidesShown = $('.slick-slider').slick('slickGetOption', 'slidesToShow'); var numberOfSlides = $('.slick-slider').find('.slick-slide').length; if (slidesShown === numberOfSlides) { $('.slick-slider').find('.slick-track').css('transform', 'translate3d(0px, 0px, 0px)'); } }); });