diff --git a/news-app/src/main.js b/news-app/src/main.js index 744dd8c..95c8df1 100644 --- a/news-app/src/main.js +++ b/news-app/src/main.js @@ -267,7 +267,7 @@ function renderCarModeCard(group, index, total) {
${Array.from({ length: total }, (_, i) => ` -
+
`).join('')}
` @@ -624,6 +624,14 @@ window.carModePrev = function() { transitionCard((state.carModeIndex - 1 + state.groups.length) % state.groups.length) } +window.carModeGoTo = function(index) { + if (state.groups.length === 0 || state.isTransitioning) return + if (index < 0 || index >= state.groups.length) return + if (index === state.carModeIndex) return // Already on this card + stopCarModeCycle() + transitionCard(index) +} + function transitionCard(newIndex) { state.isTransitioning = true render() // This adds 'fading-out' class