[slick.js] Sample of the 'adaptiveHeight' option to make the slider height variable for each slide
![[slick.js] Sample of the 'adaptiveHeight' option to make the slider height variable for each slide](img/ogp.png)
Introducing a sample of the 'adaptiveHeight' option for the jQuery slider plugin "slick.js", which adjusts the slider's height to the current slide when image sizes (heights) vary.
Here's how to equalize the heights of slides that vary.
Sample
I have prepared images with varying heights.
You will notice that the slider's height changes to match the height of the current slide.
HTML
We will create a very standard slick slider.
<div class="slider">
<div class="slide"><img src="img01.jpg"></div>
<div class="slide"><img src="img02.jpg"></div>
<div class="slide"><img src="img03.jpg"></div>
<div class="slide"><img src="img04.jpg"></div>
</div>
JS
The JS looks like this.
$(".slider").slick({
centerMode: true, //Optional
variableWidth: true, //Optional
adaptiveHeight: true, //Make slider height variable
});
You can set this by adding 'adaptiveHeight: true' on line 5.
You can also fix the height of the pager
Of course, you can also fix the height of the left and right pagers.
It's hard to click the pager if its position changes every time you move the slide, isn't it?
Comments
We also welcome reports such as 'It worked!'








If this was helpful, we appreciate your support!
All support received will go toward my child’s upbringing.
Author's Baby Registry (Amazon)
Support me via OFUSE
Alternatively, support me by purchasing something through the buttons below
(You don't have to buy the specific item linked.)
Support me via Amazon
Support me via Rakuten
Support me via Yahoo!Shopping
PR