Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SlickSlider with dots navigation and custom pagination
// see SeaGrass
if ($(".slideshow-full-container").length > 0) {
// https://github.com/kenwheeler/slick/issues/1403#issuecomment-282066130
// Test for slide length, if one, hide navigation dots
// the event needs to be run before slick is initialized
$('.slideshow-full-container').on('init', function (event, slick, direction) {
// console.log($('#full_page_slideshow .slick-slide').length);
// console.log($('.slick-slide', this).length);
// check to see if there are one or less slides
if (!($('.slick-slide', this).length > 1)) {
// 'this' allows for more than one slideshow on a webpage.
// remove arrows
$('.slick-dots', this).hide();
}
});
// Custom numbers for dots
// https://jsfiddle.net/rLLvvpcm/5/
$('.slideshow-full-container').slick({
slidesToShow: 1,
slidesToScroll: 1,
focusOnSelect: true,
arrows: false,
dots: true,
customPaging: function (slider, i) {
var thumb = $(slider.$slides[i]).data();
i++;
if (i < 10 && i > 0) {
i = "0" + i;
}
// console.log('222');
return '<a>' + i + '</a>';
}
});
// https://jsfiddle.net/rLLvvpcm/5/
// Custom numbers for dots
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.