H
H
hooli-gun2021-06-11 12:53:33
css
hooli-gun, 2021-06-11 12:53:33

Why is the slider not working?

Sliders are implemented in tabs, but only the first one works, the rest does not display correctly, what is the reason?
the code

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Warlynn, 2021-06-11
@hooli-gun

var swiper = new Swiper(".mySwiper", {
  slidesPerView: 3,
  spaceBetween: 30,
  observer: true,
  observeParents: true,
  pagination: {
    el: ".swiper-pagination",
    clickable: true,
  },
});

S
Sergey delphinpro, 2021-06-11
@delphinpro

The slider cannot be initialized on a hidden element (most often due to lack of dimensions).
So the initialization of the sliders must be done when opening the tab.
If an adequate solution is used for tabs, then they have an event that fires when the tab is displayed. This is where the initialization of the slider inside this tab is done. In your custom tabs, the slider can be triggered in the fadeIn animation callback.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question