Here, we will see how to set slides in even height automatically by using adaptive height settings in slick slider.
Follow the complete code with an example.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css"/>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css"/>
<title>Adaptive Height</title>
</head>
<body>
<div class="main">
<div class="slider slide-show">
<div class="img-wish">
<img src="s1.png" >
</div>
<div class="img-wish">
<img src="s2.png" >
<p>Hello!</p>
</div>
<div class="img-wish">
<img src="s3.png" >
</div>
<div class="img-wish">
<img src="s4.png" >
<p>Hooray!</p>
<p>Hello World!</p>
</div>
<div class="img-wish">
<img src="s5.png" >
</div>
<div class="img-wish">
<img src="s6.png" >
</div>
</div>
</div>
</body>
<script>
$('.slide-show').slick({
dots: true,
infinite: true,
speed: 300,
slidesToShow: 1,
adaptiveHeight: true
});
</script>
</html>
CSS:
Create external stylesheet and add it to the above example
body{
background:#ccc;
}
.main {
width: 300px;
display:block;
margin:0 auto;
}
.img-wish {
text-align: center !important;
margin: 20px;
}
.img-wish img {
width: 100%;
}
More examples for slick slider
Popular Posts
- Show / Hide div based on dropdown selected using jQuery
- Autosuggestion Select Box using HTML5 Datalist, PHP and MySQL with Example
- Custom Authentication Login And Registration Using Laravel 8
- Infinite Scrolling on PHP website using jQuery and Ajax with example
- Google Login or Sign In with Angular Application
- How to Convert MySQL Data to JSON using PHP
- How to change date format in PHP?
- Image Lazy loading Using Slick Slider
- Slick Slider Basic With Example
- php in_array check for multiple values
- Adaptive Height In Slick Slider
- Slick Slider Center Mode With Example
- How to Scroll to an Element with Vue 3 and ?
- JavaScript Multiple File Upload Progress Bar Using Ajax With PHP
- Slick Slider Multiple Items With Example
Total Views: 9,648