document.addEventListener('DOMContentLoaded', function() { $(document).ready(function(){ var windowwidth = $(document).width(); if ($(window).width() >= 1400) { $('.catalogslidefour').css('width',(windowwidth+20)/4+'px'); } if ($(window).width() < 1400 && $(window).width() >= 1200 ) { $('.catalogslidefour').css('width',(windowwidth+20)/3+'px'); } if ($(window).width() < 1200 && $(window).width() >= 481 ) { $('.catalogslidefour').css('width',(windowwidth+20)/2+'px'); } if ( $(window).width() < 481 ) { $('.catalogslidefour').css('width',(windowwidth+20)/1+'px'); } $(".catalogsliderfour").slick({ arrows: true, slidesToShow: 2, slidesToScroll: 2, centerMode: false, draggable: true, autoplay: false, variableWidth: true, autoplaySpeed: 5000, speed: 800, responsive: [ { breakpoint: 1400, settings: { slidesToShow: 2, slidesToScroll: 1, } }, { breakpoint: 992, settings: { slidesToShow: 1, slidesToScroll: 1, } }, { breakpoint: 768, settings: { slidesToShow: 1, slidesToScroll: 1, } }, { breakpoint: 481, settings: { slidesToShow: 1, slidesToScroll: 1, } }, ] }); function catalogfour(){ $.each($('.catalogcontfour'),function(){ var block = $(this); $(".catalogsliderfour",block).not(":first").addClass('cataloghidefour'); $(".catalognavblockfour",block).not(":first").removeClass('catalogactivefour'); $(".catalognavblockfour",block).click(function() { $(".catalognavblockfour",block).removeClass("catalogactivefour").eq($(this,block).index()).addClass("catalogactivefour"); $(".catalogsliderfour",block).css({'display':'block'}); $(".catalogsliderfour",block).removeClass('cataloghidefour'); $(".catalogsliderfour",block).hide().eq($(this,block).index()).fadeIn(); }).eq(0).addClass("catalogactivefour"); }); } catalogfour(); }); });