`;
releaseDate.parentNode.insertBefore(gridTileDiv, releaseDate.nextSibling);
gridTileDiv.innerHTML = addToCartButton;
});
}
document.addEventListener('DOMContentLoaded', function () {
const container = document.querySelector('.collectibles-best-sellers-cartridge');
const scrollLeftWrapper = document.querySelector('.collectibles-best-sellers-cartridge-scrollbox .scroll-arrow-wrapper.left');
const scrollRightWrapper = document.querySelector('.collectibles-best-sellers-cartridge-scrollbox .scroll-arrow-wrapper.right');
function updateArrows() {
const maxScrollLeft = container.scrollWidth - container.clientWidth;
if (container.scrollLeft <= 0) {
scrollLeftWrapper.style.display = 'none';
} else {
scrollLeftWrapper.style.display = 'flex';
}
if (container.scrollLeft >= maxScrollLeft - 1) {
scrollRightWrapper.style.display = 'none';
} else {
scrollRightWrapper.style.display = 'flex';
}
}
document.getElementById('collectibles-best-sellers-cartridgescrollLeft').addEventListener('click', function () {
container.scrollBy({ left: -container.clientWidth, behavior: 'smooth' });
});
document.getElementById('collectibles-best-sellers-cartridgescrollRight').addEventListener('click', function () {
container.scrollBy({ left: container.clientWidth, behavior: 'smooth' });
});
container.addEventListener('scroll', updateArrows);
const observer = new MutationObserver(updateArrows);
observer.observe(container, { childList: true, subtree: true });
window.addEventListener('load', updateArrows);
});