S
S
sorry_i_noob2019-09-04 16:40:15
JavaScript
sorry_i_noob, 2019-09-04 16:40:15

In the slick-carousel slider, responsive does not work correctly. How to fix?

There is such a code.

$('.last-reviews__items-wrap').slick({
        slidesToShow: 2,
        slidesToScroll: 2,
        infinite: true,
        accessibility: false,
        nextArrow: $('.slider-btn_dir_right.last-reviews__slider-btn'),
        prevArrow: $('.slider-btn_dir_left.last-reviews__slider-btn'),
        responsive: [
            {
                breakpoint: 993,
                settings: {
                    slidesToShow: 1,
                    slidesToScroll: 1,
                }
            }
        ]
});

The goal is to make sure that only 1 slide can be seen in the slider at a width of 992 or less. At a width greater than 992 - two slides.
This code copes with this task, but with a caveat. If you reduce the browser window, then everything works as it should. If instead you turn on the view mode on mobile devices (Toggle device toolbar), then one slide is shown only at 968.
Why is that? How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FKV, 2019-09-05
@FKV

Add a meta tag to the head

<meta name="viewport" content="width=device-width, initial-scale=1">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question