Slick carousel - force slides to have the same height

前端 未结 8 1899
刺人心
刺人心 2021-02-01 01:21

Im having trouble with the Slick carousel JS plugin with multiple slidesToShow which have different heights.

I need the Slides to have the same

8条回答
  •  生来不讨喜
    2021-02-01 01:40

    I've another css-only solution. you can override floated elements with table/table-cell.

    $(function() {
      $('.slider')
        .slick({
          autoplay: false,
          dots: false,
          infinite: false,
          arrows: false,
          slidesToShow: 2,
          slidesToScroll: 2,
          rows: 0
        });
    })
    .slide {
      background-color: #ccc;
      padding: 10px;
      display: table-cell !important;
      float: none !important;
    }
    
    .slick-track {
      display: table !important;
    }
    
    
    
    
    
    

    Lorem ipsum.

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua

    At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr.

提交回复
热议问题