A
A
aidarDev2019-08-23 13:57:56
JavaScript
aidarDev, 2019-08-23 13:57:56

How to combine slick slider and magnific popup correctly?

Using slick slider + magnific popup: example .
It is necessary that when you click on a certain button, the desired slide opens, for example, when you click on button 2, slide 2 opens in a row, when you click on 3, slide 3 opens, etc.
When you press the first time, everything works, but the second and subsequent times it does not work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-08-23
@aidarDev

$('.popup-link').magnificPopup({
  midClick: true,
  type: 'inline',
  callbacks: {
    open() {
      const $slider = $('.slider');

      if (!$slider.hasClass('slick-initialized')) {
        $slider.slick({
          infinite: true,
          slidesToShow: 1,
          dots: true,
        });
      }

      $slider.slick('slickGoTo', +$(this).attr('index'));
    },
  },
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question