Skip to content
Advertisement

Slick Carousel – RTL function

I am facing an issue in Slick Carousel to work in both LTR and RTL. It works by default in LTR, but when I change the page to RTL I get a blank container. There is an option “rtl: true” but that would make it always working in rtl.

I have tried to add a conditional function in JS file where it can work in both.

JavaScript

This is the conditional function I used. But it did not work. I’m not sure what I did wrong.

JavaScript

This is the package website: https://kenwheeler.github.io/slick/

Advertisement

Answer

to get it to work you need 2 things:

  1. add the attribute dir=”rtl” to the parent
JavaScript
  1. add the option {rtl:true} to the options

https://codepen.io/axelilali/pen/MWGMVzq

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