J
J
Jussss922021-06-21 17:36:48
JavaScript
Jussss92, 2021-06-21 17:36:48

Why does Slick slider toggle all sliders on the page?

Hello. Why might this be?
texenergo21.pr-ff.ru/category.php if you switch to a tile (click here)
60d0a3980b742246565483.png
On other pages, everything is fine, when I initialize in a card, it switches only in 1 card.
And here for some reason all the sliders at once.
The code is like this:

$('.three-sub-slider').slick({
    arrows: false,
    slidesToShow: 2,
    slidesToScroll: 1,
    vertical: true,
    asNavFor: ".cart-items-three-slider",
  })
  $('.cart-items-three-slider').slick({
    arrows: true,
    slidesToShow: 1,
    slidesToScroll: 1,
    asNavFor: ".three-sub-slider",
  })
  $('#item-grid').click((e)=> {
    console.log(e.target)
    setTimeout(()=> {
      $(".cart-items-three-slider").slick('reinit');
      $(".three-sub-slider").slick('reinit');
    },200)


  })

have to be initialized. when switching tabs it does not work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Nesov, 2021-06-21
@Ravenclaw

Along the way, ".three-sub-slider" has the same class for all product cards.
Maybe try to personalize the slider id? For example, sew the product id into it in order to get the string $('#item-grid-(product ID)').click((e)=>
And yes, with jQ 3.5.1 the asNavFor parameter works, frankly speaking , not ice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question