admin管理员组文章数量:1392101
I am using Slick Carousel on a site I am developing.
An issue I am facing is attempting to get the "slider-nav" to move in the opposite direction to the standard.
Example:-
Currently the order is as follow:-
1 2 3 4 5 6
I need it to run as the following:-
6 5 4 3 2 1
I know I could just reverse the order I am pushing then in but I need the following to happen:-
6 5 4 3 2 1
1 6 5 4 3 2
2 1 6 5 4 3
etc...
I have attempted to set the "slidesToScroll" as a -1 (as I have seen ) but this just causes my page to crash even on fiddle.
My current code look like:-
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.slider-nav',
autoplay: true,
centerMode: false,
});
$('.slider-nav').slick({
slidesToShow: 5,
infinite: true,
slidesToScroll: 1,
asNavFor: '.slider-for',
dots: false,
centerMode: false,
focusOnSelect: true,
});
Basic setup:-
/
I have also attempted to use the rtl settings but this for some reason just starts to show empty slides.
Eg. /
Any help would be greatly appreciated.
I am using Slick Carousel on a site I am developing.
An issue I am facing is attempting to get the "slider-nav" to move in the opposite direction to the standard.
Example:-
Currently the order is as follow:-
1 2 3 4 5 6
I need it to run as the following:-
6 5 4 3 2 1
I know I could just reverse the order I am pushing then in but I need the following to happen:-
6 5 4 3 2 1
1 6 5 4 3 2
2 1 6 5 4 3
etc...
I have attempted to set the "slidesToScroll" as a -1 (as I have seen ) but this just causes my page to crash even on fiddle.
My current code look like:-
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.slider-nav',
autoplay: true,
centerMode: false,
});
$('.slider-nav').slick({
slidesToShow: 5,
infinite: true,
slidesToScroll: 1,
asNavFor: '.slider-for',
dots: false,
centerMode: false,
focusOnSelect: true,
});
Basic setup:-
https://jsfiddle/5cyqtvt6/9/
I have also attempted to use the rtl settings but this for some reason just starts to show empty slides.
Eg. https://jsfiddle/5cyqtvt6/14/
Any help would be greatly appreciated.
Share Improve this question asked Mar 29, 2018 at 13:00 Tony HenslerTony Hensler 1,4926 gold badges16 silver badges30 bronze badges1 Answer
Reset to default 3I managed to fix the issue by adding
<div class="slider-for" dir="rtl">
and
<div class="slider-nav" dir="rtl">
and also updating the jQuery to the following:-
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.slider-nav',
autoplay: true,
centerMode: false,
rtl: true
});
$('.slider-nav').slick({
slidesToShow: 5,
infinite: false,
slidesToScroll: 1,
asNavFor: '.slider-for',
dots: false,
centerMode: true,
focusOnSelect: true,
rtl: true
});
Working jsFiddle:- https://jsfiddle/5cyqtvt6/16/
本文标签: javascriptSlick CarouselReversing orderStack Overflow
版权声明:本文标题:javascript - Slick Carousel - Reversing order - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744779973a2624649.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论