Last active
July 18, 2019 08:56
-
-
Save celticwebdesign/2b813587d901639cb2dc4292e9c99765 to your computer and use it in GitHub Desktop.
SlickSlider with dots navigation and custom pagination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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