Solving the Issue
Utilizing Ken Wheeler's Slick plugin has allowed me to create a carousel on my website. However, I've encountered an issue where the images inside the <a>
tag aren't evenly spaced and are even overlapping in some instances. Is there a solution to this problem?
The Solution
$('.carousel').slick({
arrows: false,
autoplay: true,
autoplaySpeed: 1000,
slidesToShow: 5,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 4
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 3
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 2
}
}
]
});
.container {
margin: 0 auto;
padding: 40px;
width: 80%;
background: #419be0;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css">
</head>
<body>
<div class='container'>
<div class='carousel'>
<div>
<a href="#"><img src="http://i.imgur.com/kkVWQR4.jpg" alt=""></a>
</div>
<div>
<a href="#"><img src="http://i.imgur.com/RRWm3lB.jpg" alt=""></a>
</div>
<div>
<a href="#"><img src="http://i.imgur.com/2f2pUHi.jpg" alt=""></a>
</div>
<div>
<a href="#"><img src="http://i.imgur.com/7TSiIkS.jpg" alt=""></a>
</div>
<div>
<a href="#"><img src="http://i.imgur.com/dXxnAnC.jpg" alt=""></a>
</div>
<div>
<a href="#"><img src="http://i.imgur.com/kkVWQR4.jpg" alt=""></a>
</div>
<div>
<a href="#"><img src="http://i.imgur.com/RRWm3lB.jpg" alt=""></a>
</div>
<div>
<a href="#"><img src="http://i.imgur.com/2f2pUHi.jpg" alt=""></a>
</div>
<div>
<a href="#"><img src="http://i.imgur.com/7TSiIkS.jpg" alt=""></a>
</div>
<div>
<a href="#"><img src="http://i.imgur.com/dXxnAnC.jpg" alt=""></a>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.js"></script>
</body>
</html>
Any assistance with resolving this issue is greatly appreciated.
Regards, Luiz.