U
U
Underdoggit2019-04-04 10:20:55
Slick
Underdoggit, 2019-04-04 10:20:55

Script not working in slick?

The script doesn't work. The task is that if the screen resolution is less than 720 pixels, slickRemove should remove the first slide. md and lg screens the slider is in the unslick position and the first slide goes back.

$(document).ready(function () {
    $('.price-table').slick({
        arrows: false,
        dots: true,
        initialSlide: 1,
        infinite: true,
        slidesToShow: 1,
        centerMode: true,
        variableWidth: true,
        mobileFirst: true,
        responsive: [
            {
             breakpoint: 720, // При разрешении меньше 721 px слайдер начинает работать
             settings: "unslick",  // вызов функции деактивации слайдера
             init: slickRemove() // инициализирую функцию ниже по удалению первого слайдера
            }
       ]
    });
    function slickRemove(){
        $('.price-table').slick('slickRemove', 0);           
    }
});

If I paste a piece of code $('.price-table').slick('slickRemove', 0);just in slick without a breakpoint, the script works, but it deletes the first slide on all screens.
$(document).ready(function () {
    $('.price-table').slick({
        arrows: false,
        dots: true,
        initialSlide: 1,
        infinite: true,
        slidesToShow: 1,
        centerMode: true,
        variableWidth: true,
        mobileFirst: true,
        responsive: [
            {
             breakpoint: 720,
             settings: "unslick",
            }
       ]
    });
    $('.price-table').slick('slickRemove', 0);           
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question