Fix carousel CSS and add debug logging
- Fixed carousel container height calculation - Only non-active items are absolutely positioned - Added console logging to debug carousel rotation - Active item stays relative to maintain container height
This commit is contained in:
@@ -387,20 +387,25 @@
|
|||||||
.upcoming-carousel-container {
|
.upcoming-carousel-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-height: 200px;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.upcoming-carousel-wrapper {
|
.upcoming-carousel-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-card.upcoming.carousel-item {
|
.event-card.upcoming.carousel-item {
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-card.upcoming.carousel-item:not(.active) {
|
||||||
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-card.upcoming.carousel-item.active {
|
.event-card.upcoming.carousel-item.active {
|
||||||
@@ -913,11 +918,14 @@
|
|||||||
|
|
||||||
// Start the upcoming events carousel
|
// Start the upcoming events carousel
|
||||||
function startUpcomingCarousel() {
|
function startUpcomingCarousel() {
|
||||||
|
console.log(`Carousel: Starting carousel with ${upcomingEvents.length} events`);
|
||||||
|
|
||||||
// Clear any existing interval
|
// Clear any existing interval
|
||||||
stopUpcomingCarousel();
|
stopUpcomingCarousel();
|
||||||
|
|
||||||
// Start new interval (5 seconds)
|
// Start new interval (5 seconds)
|
||||||
upcomingCarouselInterval = setInterval(rotateUpcomingEvent, 5000);
|
upcomingCarouselInterval = setInterval(rotateUpcomingEvent, 5000);
|
||||||
|
console.log('Carousel: Interval set for 5 seconds');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop the upcoming events carousel
|
// Stop the upcoming events carousel
|
||||||
@@ -930,13 +938,24 @@
|
|||||||
|
|
||||||
// Rotate to next upcoming event
|
// Rotate to next upcoming event
|
||||||
function rotateUpcomingEvent() {
|
function rotateUpcomingEvent() {
|
||||||
if (upcomingEvents.length <= 1) return;
|
if (upcomingEvents.length <= 1) {
|
||||||
|
console.log('Carousel: Not enough events to rotate');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const carousel = document.getElementById('upcomingCarousel');
|
const carousel = document.getElementById('upcomingCarousel');
|
||||||
if (!carousel) return;
|
if (!carousel) {
|
||||||
|
console.log('Carousel: Carousel element not found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const items = carousel.querySelectorAll('.carousel-item');
|
const items = carousel.querySelectorAll('.carousel-item');
|
||||||
if (items.length === 0) return;
|
if (items.length === 0) {
|
||||||
|
console.log('Carousel: No carousel items found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Carousel: Rotating from index ${currentUpcomingIndex} to ${(currentUpcomingIndex + 1) % upcomingEvents.length} (${items.length} total items)`);
|
||||||
|
|
||||||
const currentItem = items[currentUpcomingIndex];
|
const currentItem = items[currentUpcomingIndex];
|
||||||
const nextIndex = (currentUpcomingIndex + 1) % upcomingEvents.length;
|
const nextIndex = (currentUpcomingIndex + 1) % upcomingEvents.length;
|
||||||
|
|||||||
Reference in New Issue
Block a user