Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make slick carousel full screen?

I'm trying to make a carousel take up the entire screen, nothing I'm trying seems to work...

  $('.scroller').slick({
    dots: true,
    infinite: true,
    autoplay: true
  })
.scroller {
  div {
    text-align: center;
    font-size: 30px;
    max-height: 100%;
  }
}

.slick-prev::before, .slick-next::before {
  color: #000;
}

.slick-next {
  right: -5px;
}

.slick-prev {
  left: -5px;
}
<div class="scroller">
  <div>1</div>
  <div>2</div>
  <div>3</div>
</div>

setting the max height to 100% did nothing to fix it. It is currently only covering about one third of the page

like image 659
ncrouch25 Avatar asked Apr 11 '16 17:04

ncrouch25


2 Answers

You can set the height of the scroller dynamically to the height of the screen with JQuery:

$(document).ready(function(){
  $('.scroller').css('height', $(window).height() + 'px');
});
like image 68
A.Sharma Avatar answered Oct 09 '22 01:10

A.Sharma


In css....

Make your slick container...

height: 100vh;

then make sure BOTH:

the child element of your slick container with class .slick-track

AND

your slide elements

have height: 100%;

like image 24
Danielle Davis Avatar answered Oct 08 '22 23:10

Danielle Davis