G
G
grishaaa2018-02-27 20:37:00
JavaScript
grishaaa, 2018-02-27 20:37:00

How to count slides in slick slider?

I know how to make numbering, but here's how to make it automatically show how many slides are in the slider
5a9597054a11f850123024.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Edymov, 2018-02-28
@grishaaa

You need to output before currentSlide
And after the line slideCount
$(".slider").slick("getSlick").slideCount

L
lodas, 2018-02-28
@lodas

In one direction, you simply display the variable of the total number of slides slideCount, and apply the following code to dynamically change the number:

/*Смена цифры в слайдере*/
$(".slider").on("afterChange", function(event, slick, currentSlide, nextSlide){
    $(".countsSlides span").text(currentSlide + 1);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question