/* JAVASCRIPT */
document.addEventListener("DOMContentLoaded", function() {
// Find the carousel container
var carousel = document.getElementById("ubc-image-carousel");
if (carousel) {
// Get all the images inside the carousel
var slides = carousel.getElementsByTagName("img");
if (slides.length > 1) {
var currentSlide = 0;
// Run the transition every 5000 milliseconds (5 seconds)
setInterval(function() {
// Remove the active class from the current image
slides[currentSlide].classList.remove("ubc-slide-active");
// Move to the next image, and loop back to 0 if at the end
currentSlide = (currentSlide + 1) % slides.length;
// Add the active class to the new image to fade it in
slides[currentSlide].classList.add("ubc-slide-active");
}, 5000);
}
}
});