M
M
MegaPuxapb2018-08-14 17:30:31
JavaScript
MegaPuxapb, 2018-08-14 17:30:31

Slick slider in bootstrap3 modal?

Slider doesn't work on first launch.
5b72ee4577da5810902600.jpeg
If you refresh the page or scroll to the next. slide is ok.
How to fix?

//goods_slider 
  $('#modalGoods').on('shown.bs.modal', function () {
    $('.goods_slider').fadeIn(500);
    $('.goods_slider').resize();
  });

  $('#modalGoods').on('hidde.bs.modal', function () {
    $('.goods_slider').resize();
    $('.goods_slider').fadeOut();
  });
  
  $('.goods_slider').slick({
    slidesToShow: 3,
    speed: 1000,
    dots: false,
    arrows: true,
    responsive: [
        {
          breakpoint: 768,
          settings: {
          	centerMode: false,
          	slidesToShow: 1,
          	dots: false,
          	arrows: true,
          }
      }]       
  });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tyzberd, 2018-08-14
@MegaPuxapb

You hang an opening event on the window, and in it you call
$('.slick-slider').slick('refresh');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question