diff --git a/public/js/carousel.js b/public/js/carousel.js index d251cd7..4daaa46 100644 --- a/public/js/carousel.js +++ b/public/js/carousel.js @@ -1,4 +1,7 @@ -function initCarousel(container, durationMS = 0) { +function initCarousel(container, options = {}) { + const durationMS = options.durationMS ?? 0; + const onChange = options.onChange ?? (() => {}); + const numCarouselItems = container.querySelectorAll('.carousel-item').length; const buttonContainer = container.querySelector('.carousel-buttons'); @@ -25,6 +28,8 @@ function initCarousel(container, durationMS = 0) { buttons[i].classList.add('active'); current = i; + + onChange(current); } function activateNext() { diff --git a/src/templates/src/project_index.html b/src/templates/src/project_index.html index ea28d42..36eef58 100644 --- a/src/templates/src/project_index.html +++ b/src/templates/src/project_index.html @@ -71,6 +71,8 @@ {{ end }} diff --git a/src/templates/src/wheeljam_2022_index.html b/src/templates/src/wheeljam_2022_index.html index be6962d..ea2bcfb 100644 --- a/src/templates/src/wheeljam_2022_index.html +++ b/src/templates/src/wheeljam_2022_index.html @@ -428,7 +428,15 @@