I have built a custom code for a clickable collection slider. Now I have a few design problems. The current slider looks like this. Does anyone have any ideas on what I need to change?
This should be the result with the slideable function. It would be nice to add pagination dots.
This is the code for the clickable collection slider:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css"/>
<style>
.mobile-collection-slider {
max-width: 1600px;
padding-top: 70px;
padding-bottom: 12px;
background: #f8f8f8;
display: flex;
flex-wrap: wrap;
gap: 30px;
justify-content: center;
}
.mobile-collection-slider .carousel-cell {
width: 100px !important;
height: 100px !important;
position: relative !important;
}
.mobile-collection-slider .carousel-cell a {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
border-radius: 15%;
background: white;
}
.mobile-collection-slider img {
object-fit: cover;
width: 75%;
height: 75%;
justify-content: center;
align-items: center;
}
.carousel-cell:hover a {
border: 3px solid #373737;
}
.carousel-cell.clicked a {
border: 3px solid #373737;
}
@media only screen and (max-width: 479px) {
.mobile-collection-slider .carousel-cell {
width: 100px;
height: 100px;
}
.mobile-collection-slider {
gap: 15px;
padding-top: 40px;
}
}
</style>
</head>
<body>
<div class="mobile-collection-slider slick-carousel">
<div class="carousel-cell" data-url="https://stampforge.de/collections/geburtstag">
<a href="#" class="image-link">
<img src="https://cdn.shopify.com/s/files/1/0706/9266/7657/files/Bild4.png?v=1706181350" border="0" />
</a>
</div>
<div class="carousel-cell" data-url="https://stampforge.de/collections/hochzeit">
<a href="#" class="image-link">
<img src="https://cdn.shopify.com/s/files/1/0706/9266/7657/files/Bild4.png?v=1706181350" border="0" />
</a>
</div>
<div class="carousel-cell" data-url="https://stampforge.de/collections/neues-jahr">
<a href="#" class="image-link">
<img src="https://cdn.shopify.com/s/files/1/0706/9266/7657/files/Bild4.png?v=1706181350" border="0" />
</a>
</div>
<div class="carousel-cell" data-url="https://stampforge.de/collections/valentinstag">
<a href="#" class="image-link">
<img src="https://cdn.shopify.com/s/files/1/0706/9266/7657/files/Bild4.png?v=1706181350" border="0" />
</a>
</div>
<div class="carousel-cell" data-url="https://stampforge.de/collections/weihnachten">
<a href="#" class="image-link">
<img src="https://cdn.shopify.com/s/files/1/0706/9266/7657/files/Bild4.png?v=1706181350" border="0" />
</a>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var cells = document.querySelectorAll('.carousel-cell');
var currentURL = window.location.href;
cells.forEach(function(cell) {
cell.addEventListener('click', function() {
cells.forEach(function(c) {
c.classList.remove('clicked');
});
this.classList.add('clicked');
var url = this.getAttribute('data-url');
window.location.href = url;
});
var cellURL = cell.getAttribute('data-url');
if (currentURL.includes(cellURL)) {
cell.classList.add('clicked');
}
});
$('.mobile-collection-slider').slick({
slidesToShow: 3,
slidesToScroll: 1,
});
});
</script>
</body>
</html>