From 8c085b88092c4a0de95b9cb31dcedaa79d9dd37c Mon Sep 17 00:00:00 2001 From: Oleg Roschupkin Date: Thu, 1 Mar 2012 15:32:49 +0900 Subject: [PATCH] Add support for slide transition (Issue #59). --- scripts/script.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/script.js b/scripts/script.js index a5ff892..f6c06bd 100755 --- a/scripts/script.js +++ b/scripts/script.js @@ -88,6 +88,26 @@ progress.style.width = (100 / (slideList.length - 1) * normalizeSlideNumber(slideNumber)).toFixed(2) + '%'; } + function updateCurrentAndPassedSlides(slideNumber) { + var i, l = slideList.length, slide; + slideNumber = normalizeSlideNumber(slideNumber); + + for ( i = 0; i < l; ++i ) { + slide = document.getElementById(slideList[i].id); + + if ( i < slideNumber ) { + slide.classList.remove('current'); + slide.classList.add('passed'); + } else if ( i > slideNumber ) { + slide.classList.remove('passed'); + slide.classList.remove('current'); + } else { + slide.classList.remove('passed'); + slide.classList.add('current'); + } + } + } + function getSlideHash(slideNumber) { return '#' + slideList[normalizeSlideNumber(slideNumber)].id; } @@ -97,6 +117,7 @@ if (!isListMode()) { updateProgress(slideNumber); + updateCurrentAndPassedSlides(slideNumber); } }