Q
Q
Qurel2019-01-18 21:06:44
JavaScript
Qurel, 2019-01-18 21:06:44

Does responsive work incorrectly in slick-slider in chrome and opera?

I set a breakpoint of 768px to show 2 sliders, but this works at a screen resolution of 687px.

$(document).ready(function () {
  sertificatesSlider();
});
var sertificatesSlider = function() {
    if($(window).width() < 992) {
        $('.sertificates-slider').slick({
            slidesToShow: 3,
            slidesToScroll: 1,
            dots: false,
            prevArrow: '.sertificates__btn--prev',
            nextArrow: '.sertificates__btn--next',
            responsive: [
                {
                  breakpoint: 768,
                  settings: {
                    slidesToShow: 2,
                    slidesToScroll: 1,
                  }
                }]
        });
    } 
    
    else {
        $('.sertificates-slider').slick('unslick');
    }
};
var sertificatesSlider = function() {

    var sliderElement = $('.sertificates-slider');

    if($(window).width() < 992 && !(sliderElement.hasClass('slick-initialized'))) {
        sliderElement.slick({
            slidesToShow: 3,
            slidesToScroll: 1,
            dots: false,
            prevArrow: '.sertificates__btn--prev',
            nextArrow: '.sertificates__btn--next',
            responsive: [
                {
                  breakpoint: 768,
                  settings: {
                    slidesToShow: 2,
                    slidesToScroll: 1,
                  }
                }]
            
        });
    } else if ($(window).width() > 992 && sliderElement.hasClass('slick-initialized')) {
        sliderElement.slick('unslick');
    }
};
$(window).on('resize', function() {
    sertificatesSlider();
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Serg Bakay, 2019-01-24
@Bakay_Sergey

with unslick it is poorly documented there he stuffed cones himself, here's how to use it:5c4a22ed4eff0164753772.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question