How do I get the count of slides in the slider?

See original GitHub issue

I want to “sync” the slider based on some passed date. For example: I have slides with identifier 1, 2, 5. So I add <div id="slide-id-1">...</div> respectively for every ID.

Now, I get some other data: 1, 2, 4. So I have to remove slide with ID 5. My first thought is to iterate through every slide based on their index and then call slick('removeSlide' index). However, I can’t find in the docs a method to get the count of slides.

How can I get this?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

2reactions
ericdownscommented, May 2, 2017

I’m also very interested in this.

1reaction
PoundXIcommented, Aug 7, 2020

Not sure if this is exactly what you’re after, but I can get the number of slides like this:

$(".mySlider").on("init", function (event, slick) {
            var numSlides = slick.slideCount;
            console.log(numSlides);
        });

Thanks for property name slideCount. Now I can get the number of slides with this.

$('#slick').slick('getSlick').slideCount
Read more comments on GitHub >

github_iconTop Results From Across the Web

Slick.js: Get current and total slides (ie. 3/5) - Stack Overflow
The slider object contains the slide count as property. Slick < 1.5. $('.slideshow').slick({ slide: 'img', autoplay: true, dots: true, ...
Read more >
Show the slide number and total number of slides on every slide
Show the slide number and total number of slides on every slide · On the View tab, in the Presentation Views group, click...
Read more >
slick slider with count - CodePen
1. var $slider = $('.slider'); ; 2. ​ ; 3. if ($slider.length) { ; 4. var currentSlide; ; 5. var slidesCount;.
Read more >
How to add a slide count to a slider using Soliloquy
To add a slide counter to your Soliloquy slides, just add the following code to a new file at wp-content/plugins/soliloquy-slide-count.php . <?
Read more >
Get slide count · Issue #1219 · kenwheeler/slick - GitHub
simeydotme commented on Apr 8, 2015. $(".slider").
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found