From bf5c302c0bf215df89e5f290663ce4a1ada048a1 Mon Sep 17 00:00:00 2001 From: fvdpol Date: Wed, 8 Jan 2025 12:45:55 -0400 Subject: [PATCH] fix carousel to support multiple list items --- assets/js/carousel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/carousel.js b/assets/js/carousel.js index a5889a5e..f51a76f3 100755 --- a/assets/js/carousel.js +++ b/assets/js/carousel.js @@ -7,7 +7,7 @@ document.addEventListener('DOMContentLoaded', function() { carousels.forEach(function( carousel ) { const ele = carousel.querySelector('ul'); - const scrolllength = carousel.querySelector('ul li:nth-child(2)').offsetLeft - carousel.querySelector('ul li:nth-child(1)').offsetLeft; + const scrolllength = carousel.querySelector('ul .item:nth-child(2)').offsetLeft - carousel.querySelector('ul .item:nth-child(1)').offsetLeft; const amountvisible = Math.round(ele.offsetWidth/scrolllength); const bullets = carousel.querySelectorAll('ol li'); const nextarrow = carousel.querySelector('.next');