0

Hi referring to this question, the js is count by slide. My slidetoshow is 3 per page. How can I make it count by page? That mean

  • 1/3
  • 2/3
  • 3/3

Here's my result for now:

  • 1/3
  • 4/3
  • 7/3

enter image description here

enter image description here

enter image description here

$slickElement.on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {
        if (!slick.$dots) {
            return;
        }

        var i = (currentSlide ? currentSlide : 0) + 1;
        $status.text(i + ' / ' + slick.$dots[0].children.length);
    });
Richard Dallaway
  • 4,250
  • 1
  • 28
  • 39
jacksmug
  • 25
  • 5

1 Answers1

0

how about just recalculate it ?

var perPage = 3;
var total = slick.$dots[0].children.length;
var i = currentSlide > 0 ? currentSlide/perPage : 0;
$status.text(i + ' / ' + total);
i.Nemiro
  • 150
  • 6
  • 1
    Thanks for the reply, it's working now and just need to add + 1 from your code. `var i = (currentSlide > 0 ? currentSlide/perPage : 0) + 1;` Thank you so much! – jacksmug Apr 28 '20 at 06:39