Skip to content
jQuery(document).ready(function ($) {
var swiper = new Swiper(".custom-swiper", { // Use a specific class
slidesPerView: "auto",
spaceBetween: 10,
loop: true,
autoplay: {
delay: 3000,
},
navigation: {
nextEl: ".custom-swiper-button-next",
prevEl: ".custom-swiper-button-prev",
},
pagination: {
el: ".custom-swiper-pagination",
clickable: true,
},
});
// Adjust slides width dynamically based on image size
$(".custom-swiper .swiper-slide img").each(function () {
let img = $(this);
img.on("load", function () {
img.parent().css("width", img[0].naturalWidth + "px");
}).each(function () {
if (this.complete) $(this).trigger("load");
});
});
});