Skip to content

Instantly share code, notes, and snippets.

@sukhikh18
Forked from iiiBird/slide_count.js
Last active April 1, 2020 21:05
Show Gist options
  • Save sukhikh18/52c85152233cc792610471a678237888 to your computer and use it in GitHub Desktop.
Save sukhikh18/52c85152233cc792610471a678237888 to your computer and use it in GitHub Desktop.
slick slide count and all slides
var $slider = $('.slider'),
$current = $('<span class="current">'),
$summary = $('<span class="summary">');
$slider
.on('init', function(event, slick) {
$current.html(1);
$summary.html(slick.slideCount);
$('.slick-dots')
.wrap('<div class="info">')
.before($current)
.after($summary);
})
.on('afterChange', function(event, slick, currentSlide, nextSlide) {
$current.html(currentSlide + 1);
})
.slick();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment