<div class="klevu-recs cmsb37-h-[610px] cmsb37-ease-in-out cmsb37-duration-300" x-data="{ shown: false }" x-intersect="shown = true" id="k-cdbb96a3-dd65-498c-b4c1-355e713b380d"></div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<style>
.swiper-scrollbar-drag {
background-color: #064f84;
}
.swiper-scrollbar.swiper-scrollbar-horizontal {
height: 10px;
background-color: #ccc;
left: 0;
right: 0;
width: 100%;
}
.swiper-wrapper {
padding-bottom: 50px;
}
</style>
<script>
// Variable to track whether the scrollbar has been added
var scrollbarAppended = false;
// Function to check if the element is present and append if not
function checkAndAppendScrollbar() {
// Find the element with the specified classes
var swiperContainer = document.querySelector('.more-seller-items .swiper');
// Check if the element is present
if (swiperContainer && !scrollbarAppended) {
// Element is present, clear the interval and append the new div
clearInterval(intervalId1);
scrollbarAppended = true;
// Create a new div element
var newDiv = document.createElement('div');
// Set the class for the new div
newDiv.className = 'swiper-scrollbar';
// Append the new div to the .swiper container
swiperContainer.appendChild(newDiv);
}
}
// Check every second
var intervalId1 = setInterval(checkAndAppendScrollbar, 1000);
// Optionally, you can stop checking after a certain amount of time
// Uncomment the following line and adjust the time in milliseconds as needed
// setTimeout(function() { clearInterval(intervalId); }, 10000);
</script>
<script>
function initializeSwiper() {
console.log("init here");
const swiper = new Swiper(".swiper", {
// Optional parameters
direction: "horizontal",
loop: false,
// If we need pagination
pagination: {
el: ".swiper-pagination",
},
allowTouchMove: true,
noSwiping: false,
mousewheel: {
forceToAxis: true,
},
// Navigation arrows
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
// And if we need scrollbar
scrollbar: {
el: ".swiper-scrollbar",
hide: false,
enabled: true,
draggable: true,
},
freeMode: true,
slidesPerView: 4, // Set the number of slides to show in the view
grabCursor: true,
// Responsive breakpoints
breakpoints: {
// when window width is >= 320px
0: {
slidesPerView: 1,
},
// when window width is >= 640px
480: {
slidesPerView: 2,
},
// when window width is >= 1024
1024: {
slidesPerView: 3,
},
// when window width is >= 1280
1280: {
slidesPerView: 4,
},
},
});
}
function checkAndInitialize() {
const elementsExist = document.querySelectorAll(".kuRECS-itemWrap.kuRECSItem.border.border-ahy-bg.swiper-slide").length > 0;
if (elementsExist) {
initializeSwiper();
}
const elementsExistCount = document.querySelectorAll(".kuRECS-itemWrap.kuRECSItem.border.border-ahy-bg.swiper-slide").length >= 1;
console.log(elementsExistCount);
if (elementsExistCount) {
setTimeout(() => {
clearInterval(interval2);
}, 5000); // 5000 milliseconds = 5 seconds
}
}
// Check every second
const interval2 = setInterval(checkAndInitialize, 1000);
</script>
The information below is required for social login
Sign In
Create New Account