Optimize slideshow distance calculation for circular navigation

This commit is contained in:
CodeDevMLH
2026-03-08 20:28:20 +01:00
parent f47c9dde88
commit 64e5441aff

View File

@@ -2454,6 +2454,7 @@ const SlideshowManager = {
previousVisibleSlide.classList.remove("active"); previousVisibleSlide.classList.remove("active");
} }
void currentSlide.offsetWidth;
currentSlide.classList.add("active"); currentSlide.classList.add("active");
// Manage Video Playback: Stop others, Play current // Manage Video Playback: Stop others, Play current
@@ -2731,9 +2732,9 @@ const SlideshowManager = {
const totalItems = STATE.slideshow.itemIds.length; const totalItems = STATE.slideshow.itemIds.length;
let distance = Math.abs(index - currentIndex); let distance = Math.abs(index - currentIndex);
if (totalItems > keepRange * 2) {
distance = Math.min(distance, totalItems - distance); // Always calculate circular distance for slideshow
} distance = Math.min(distance, totalItems - distance);
if (distance > keepRange) { if (distance > keepRange) {
// Destroy video player if exists // Destroy video player if exists