fix 'fragments' config option (#849)
This commit is contained in:
parent
7529f7eeb8
commit
3d7c21256c
36
js/reveal.js
36
js/reveal.js
@ -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,26 +1776,30 @@ 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' );
|
||||||
|
|
||||||
var pastFragments = toArray( element.querySelectorAll( '.fragment' ) );
|
if( config.fragments ) {
|
||||||
|
var pastFragments = toArray( element.querySelectorAll( '.fragment' ) );
|
||||||
|
|
||||||
// Show all fragments on prior slides
|
// Show all fragments on prior slides
|
||||||
while( pastFragments.length ) {
|
while( pastFragments.length ) {
|
||||||
var pastFragment = pastFragments.pop();
|
var pastFragment = pastFragments.pop();
|
||||||
pastFragment.classList.add( 'visible' );
|
pastFragment.classList.add( 'visible' );
|
||||||
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' );
|
||||||
|
|
||||||
var futureFragments = toArray( element.querySelectorAll( '.fragment.visible' ) );
|
if( config.fragments ) {
|
||||||
|
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
|
||||||
while( futureFragments.length ) {
|
while( futureFragments.length ) {
|
||||||
var futureFragment = futureFragments.pop();
|
var futureFragment = futureFragments.pop();
|
||||||
futureFragment.classList.remove( 'visible' );
|
futureFragment.classList.remove( 'visible' );
|
||||||
futureFragment.classList.remove( 'current-fragment' );
|
futureFragment.classList.remove( 'current-fragment' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
js/reveal.min.js
vendored
6
js/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user