P
P
proaxi2020-04-27 01:42:04
JavaScript
proaxi, 2020-04-27 01:42:04

How to make independent numbering of slides in different sliders?

You want the slide number to be reflected within the slide itself.

At the same time, in each slider on the page, so that it works individually.
Now everything works only in the first slider, even when working with the second, third, fifth, etc. sliders. There will be many sliders of the same type. You can make different classes for sliders, but I would like an optimal solution in js so as not to write duplicate code in js and css.

https://codepen.io/maxxxxxxxxxxxx/pen/qBOrayK

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-04-27
@proaxi

$('.bakeries-slider').each(function() {
  $('.bakeries-slider__span', this).text(i => `${i + 1}.`);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question