Slick carousel right to left

前端 未结 5 1662
有刺的猬
有刺的猬 2021-02-05 23:18

I\'ve setup slick carousel to continuously scroll, however I need to to scroll in the oposite direction. Adding the RTL option didn\'t seem to work.

Fiddle here (current

5条回答
  •  -上瘾入骨i
    2021-02-06 00:02

    Setup "slidesToScroll" property to a negative value (e.g slidesToScroll: -1,) is not a native solution. This produced images smooth flow problem.

    The right way is to add an attribute dir="ltr" to the slider's container (HTML element) OR add rtl: false property to slider settings:

    // add an attribute dir="ltr" to the slider's container
    //$('.slider').attr('dir', 'ltr');
    
    // OR add `rtl: false` property to slider settings
    
    $('.slider').slick({
      autoplay: true,
      slidesToShow: 3,
      slidesToScroll: 3,
      dots: true,
      infinite: true,
      cssEase: 'linear',
      rtl: false
    });
    

    Note: This will reverse text direction also which can be changed by the CSS direction: ltr;

    JS Fiddle Example

提交回复
热议问题