fix 'fragments' config option (#849)

This commit is contained in:
Hakim El Hattab 2014-03-25 14:28:22 +01:00
parent 7529f7eeb8
commit 3d7c21256c
2 changed files with 27 additions and 15 deletions

View File

@ -607,6 +607,14 @@ var Reveal = (function(){
autoSlidePaused = false; autoSlidePaused = false;
} }
// When fragments are turned off they should be visible
if( config.fragments === false ) {
toArray( dom.slides.querySelectorAll( '.fragment' ) ).forEach( function( element ) {
element.classList.add( 'visible' );
element.classList.remove( 'current-fragment' );
} );
}
// Load the theme in the config, if it's not already loaded // Load the theme in the config, if it's not already loaded
if( config.theme && dom.theme ) { if( config.theme && dom.theme ) {
var themeURL = dom.theme.getAttribute( 'href' ); var themeURL = dom.theme.getAttribute( 'href' );
@ -1768,6 +1776,7 @@ var Reveal = (function(){
// Any element previous to index is given the 'past' class // Any element previous to index is given the 'past' class
element.classList.add( reverse ? 'future' : 'past' ); element.classList.add( reverse ? 'future' : 'past' );
if( config.fragments ) {
var pastFragments = toArray( element.querySelectorAll( '.fragment' ) ); var pastFragments = toArray( element.querySelectorAll( '.fragment' ) );
// Show all fragments on prior slides // Show all fragments on prior slides
@ -1777,10 +1786,12 @@ var Reveal = (function(){
pastFragment.classList.remove( 'current-fragment' ); pastFragment.classList.remove( 'current-fragment' );
} }
} }
}
else if( i > index ) { else if( i > index ) {
// Any element subsequent to index is given the 'future' class // Any element subsequent to index is given the 'future' class
element.classList.add( reverse ? 'past' : 'future' ); element.classList.add( reverse ? 'past' : 'future' );
if( config.fragments ) {
var futureFragments = toArray( element.querySelectorAll( '.fragment.visible' ) ); var futureFragments = toArray( element.querySelectorAll( '.fragment.visible' ) );
// No fragments in future slides should be visible ahead of time // No fragments in future slides should be visible ahead of time
@ -1790,6 +1801,7 @@ var Reveal = (function(){
futureFragment.classList.remove( 'current-fragment' ); futureFragment.classList.remove( 'current-fragment' );
} }
} }
}
// If this element contains vertical slides // If this element contains vertical slides
if( element.querySelector( 'section' ) ) { if( element.querySelector( 'section' ) ) {

6
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long