Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slick carousel right to left

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 (currently left to right)

http://jsfiddle.net/mth2ghod/

 $(function(){
    $('.slider').slick({

        speed: 10000,
        autoplay: true,
        autoplaySpeed: 100,
        cssEase: 'linear',
        slidesToShow: 1,
        slidesToScroll: 1,
        variableWidth: true

    });
});
like image 884
benc Avatar asked Apr 21 '15 11:04

benc


3 Answers

in your rtl css add below without any edit on

[dir='rtl'] .slick-slide { float: left; }

like image 199
Bilal Talal Avatar answered Sep 23 '22 13:09

Bilal Talal


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

like image 16
Boy Mark Avatar answered Nov 07 '22 00:11

Boy Mark


Change the slidesToScroll to a -1 (it will change the slide direction)

 $(function(){
    $('.slider').slick({
       speed: 10000,
       autoplay: true,
       autoplaySpeed: 100,
       cssEase: 'linear',
       slidesToShow: 1,
       slidesToScroll: -1,
       variableWidth: true

    });
});
like image 14
Bob Tate Avatar answered Nov 06 '22 22:11

Bob Tate