Skip to content
Advertisement

Can i use different images for each custom dots for my slick slider?

i have a question for slick slider veterans:

I want to put custom images for my dots on a slick slider, but i want to use different images for my slider dots. So for example i have 5 slides, and i want my 5 dots to have seperate images, so 5 different images (10 if i use different ones for active and inactive state)

Can anyone advice me on this how i approach this? I wanted to try with this here, but then i realised that it only works with the same image for each dot:

JavaScript

Advertisement

Answer

You could assign a custom image url as a data attribute to your slide div, and then on slick init, loop through your dots, grab the custom dot image url and render it into the slick dot by slide id.

Notice in my example I am setting a dot image in the .slick-slide div using this data attribute…

JavaScript

Here is a fiddle… https://jsfiddle.net/joshmoto/fxy7gudv/

See working example below…

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement