From 0140fd9ee6e8d0f193ab594d1df4a9f923c8a0df Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Thu, 13 Mar 2014 10:32:57 +0100 Subject: include fragments in progress bar calculation --- js/reveal.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'js/reveal.js') diff --git a/js/reveal.js b/js/reveal.js index b2869c0..f6edd45 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2215,6 +2215,25 @@ var Reveal = (function(){ } + if( currentSlide ) { + + var allFragments = currentSlide.querySelectorAll( '.fragment' ); + + // If there are fragments in the current slide those should be + // accounted for in the progress. + if( allFragments.length > 0 ) { + var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' ); + + // This value represents how big a portion of the slide progress + // that is made up by its fragments (0-1) + var fragmentWeight = 0.9; + + // Add fragment progress to the past slide count + pastCount += ( visibleFragments.length / allFragments.length ) * fragmentWeight; + } + + } + return pastCount / ( totalCount - 1 ); } @@ -2519,6 +2538,7 @@ var Reveal = (function(){ } updateControls(); + updateProgress(); return !!( fragmentsShown.length || fragmentsHidden.length ); -- cgit v1.2.3