Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slick carousel full width with center mode not working

I am trying to create a full width page slider with one slide to be centered and 2 slides will be partially visible at both sides.

But for some reason there is a big white gap visible. I tried with giving img width 100% but the image resolution is distorting.

Jquery code:

$('.slider').slick({
  centerMode: true,
  slidesToShow: 1,
  slidesToScroll: 1,
  dots: true,
  infinite: true,
  cssEase: 'linear'
});

Demo -- https://jsfiddle.net/squidraj/hn7xsa4y/

Any help is highly appreciated.

like image 858
Prithviraj Mitra Avatar asked Feb 05 '17 20:02

Prithviraj Mitra


People also ask

What is a slick carousel?

A slideshow component for cycling through elements—images or slides of text—like a carousel.


1 Answers

You might want to try using :

$('.slider').slick({
centerMode:true,
    slidesToShow: 1,
    slidesToScroll: 1,
    dots: true,
    infinite: true,
    cssEase: 'linear',
    variableWidth: true,
    variableHeight: true
});

This should remove the gap, but you might need to add some css to make sure that the slick <div> will be large enough to display your whole image. You can also modify the css for the related images.

like image 107
Squick Avatar answered Oct 15 '22 00:10

Squick