Skip to content

Instantly share code, notes, and snippets.

@celticwebdesign
Last active July 18, 2019 08:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save celticwebdesign/2b813587d901639cb2dc4292e9c99765 to your computer and use it in GitHub Desktop.
Save celticwebdesign/2b813587d901639cb2dc4292e9c99765 to your computer and use it in GitHub Desktop.
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