$(window).resize(function(){ if (window.innerWidth < 480) { $('.slider-nav').slick({ slidesToShow: 2, slidesToScroll: 1, dots: true, arrows: false, autoplay:true, autoplaySpeed:3800, focusOnSelect: true }); //} if (window.innerWidth < 768) { // $('.slider-nav').slick({ // slidesToShow: 2, // slidesToScroll: 1, // dots: true, // arrows: false, // autoplay:true, // autoplaySpeed:3800, // focusOnSelect: true // }); } else { $('.slider-nav').slick({ slidesToShow: 4, slidesToScroll: 1, dots: true, arrows: false, autoplay:true, autoplaySpeed:3800, focusOnSelect: true }); } }); $('a[data-slide]').click(function(e) { e.preventDefault(); var slideno = $(this).data('slide'); $('.slider-nav').slick('slickGoTo', slideno - 1); });