David
David

Reputation: 69

Slick slider number of slides and dots

I've came across multiple answers on how to replace dots with current/total number of slides (3/5). But I haven't found if it's possible to keep dots, and at the end of the dots to append current/total number of slides.

Is that possible?

Upvotes: 1

Views: 11687

Answers (1)

Oliver Ong
Oliver Ong

Reputation: 97

Adding parameter dots: true will show your the dots as well as the current and total.

Example:

HTML:

<div class="slideshow">
    <img src="http://lorempixel.com/500/250" />
    <img src="http://lorempixel.com/500/251" />
    <img src="http://lorempixel.com/500/249" />
</div>

Javascript:

$('.slideshow').slick({
    slide: 'img',
    autoplay: true,
    dots: true,
    dotsClass: 'custom_paging',
    customPaging: function (slider, i) {
        //FYI just have a look at the object to find aviable information
        //press f12 to access the console
        //you could also debug or look in the source
        console.log(slider);
        return (i + 1) + '/' + slider.slideCount;
    }
});

do check this post for more detail, it also has the fiddle which i got this code from. Slick.js: Get current and total slides (ie. 3/5)

Upvotes: 1

Related Questions