I want to make a slide (using Slick.js),
based on the picture, I want to make centerMode:true
and focusOnSelect:true
...
but the problem is there will be two excess slide (left and right). How do I remove them?
I already tried to set centerMode
to false
. There will be no excess slide, but the selected slide will be on the most left. So it is important for me to set the centerMode
to true
, because I want to make the selected slide in center.
Sorry for my bad english.
Any help will be appreciated.
Thanks
Either you can give a fixed padding to the right or percentage. You can do something like this slidesToShow: 3.5 and make infinite: false . The right most slide will be showing half.
The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It works with a series of images, text, or custom markup. It also includes support for previous/next controls and indicators. Official documentation.
You could create a method that applies an opacity
of 0
to the slide that appears before the first as well as to the slide that appears after the last i.e. the partial slides. You can call this method after initialization of the slider and after every slide change via the afterChange
event:
function setSlideVisibility() {
//Find the visible slides i.e. where aria-hidden="false"
var visibleSlides = $('.slick-slide[aria-hidden="false"]');
//Make sure all of the visible slides have an opacity of 1
$(visibleSlides).each(function() {
$(this).css('opacity', 1);
});
//Set the opacity of the first and last partial slides.
$(visibleSlides).first().prev().css('opacity', 0);
$(visibleSlides).last().next().css('opacity', 0);
}
$(setSlideVisibility());
$('.slider').on('afterChange', function() {
setSlideVisibility();
});
Fiddle Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With