function setEqualHeight() {
// Select all the slides in the carousel
const slides = document.querySelectorAll("selector .swiper-slide");
let maxHeight = 0;
// Reset heights to auto to recalculate
slides.forEach(slide => {
slide.style.height = "auto";
});
// Find the tallest slide
slides.forEach(slide => {
const slideHeight = slide.offsetHeight;
if (slideHeight > maxHeight) maxHeight = slideHeight;
});
// Apply the tallest height to all slides
slides.forEach(slide => {
slide.style.height = `${maxHeight}px`;
});
}
// Run the function after the carousel is loaded
document.addEventListener("DOMContentLoaded", () => {
setEqualHeight();
// Adjust heights on window resize
window.addEventListener("resize", setEqualHeight);
});