kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.49k stars 5.89k forks source link

Slick Carousel - RTL #4214

Open Abdullah92h opened 1 year ago

Abdullah92h commented 1 year ago

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.

function rtl_slick(){
if ($('body').hasClass("rtl")) {
   return true;
} else {
   return false;
}}

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

$('.first-screen-slider').slick({
        infinite: true,
        slidesToShow: 1,
        slidesToScroll: 1,
        arrows: false,
        dots: false,
        autoplay: true,
        autoplaySpeed: 2000
        rtl: rtl_slick(), // this is where the function should work
    });
cstp55 commented 8 months ago

rtl:true is not working for magento 2