include fragments in progress bar calculation

This commit is contained in:
Hakim El Hattab 2014-03-13 10:32:57 +01:00
parent a91f4d601d
commit 0140fd9ee6
2 changed files with 22 additions and 2 deletions

View File

@ -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 );

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long