diff options
author | Hakim El Hattab | 2013-11-28 09:35:04 -0500 |
---|---|---|
committer | Hakim El Hattab | 2013-11-28 09:35:04 -0500 |
commit | f7b612b1e4a916e5847cdf84be5628bd187a562f (patch) | |
tree | ead8f08e71441380348623bcede5d3301704537b /js/reveal.js | |
parent | b314cf7b27c913c03ec5c36fd7c1b765732ef3e2 (diff) |
only run vertical slide setup during startup #726
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/js/reveal.js b/js/reveal.js index 26ebc48..98d802e 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -316,8 +316,8 @@ var Reveal = (function(){ // Make sure we've got all the DOM elements we need setupDOM(); - // Decorate the slide DOM elements with state classes (past/future) - formatSlides(); + // Resets all vertical slides so that only the first is visible + resetVerticalSlides(); // Updates the presentation to match the current configuration values configure(); @@ -1603,7 +1603,7 @@ var Reveal = (function(){ // Re-create the slide backgrounds createBackgrounds(); - formatSlides(); + sortAllFragments(); updateControls(); updateProgress(); @@ -1613,10 +1613,10 @@ var Reveal = (function(){ } /** - * Iterates through and decorates slides DOM elements with - * appropriate classes. + * Resets all vertical slides so that only the first + * is visible. */ - function formatSlides() { + function resetVerticalSlides() { var horizontalSlides = toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); horizontalSlides.forEach( function( horizontalSlide ) { @@ -1624,7 +1624,29 @@ var Reveal = (function(){ var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ); verticalSlides.forEach( function( verticalSlide, y ) { - if( y > 0 ) verticalSlide.classList.add( 'future' ); + if( y > 0 ) { + verticalSlide.classList.remove( 'present' ); + verticalSlide.classList.remove( 'past' ); + verticalSlide.classList.add( 'future' ); + } + + } ); + + } ); + + } + + /** + * Sorts and formats all of fragments in the + * presentation. + */ + function sortAllFragments() { + + var horizontalSlides = toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); + horizontalSlides.forEach( function( horizontalSlide ) { + + var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ); + verticalSlides.forEach( function( verticalSlide, y ) { sortFragments( verticalSlide.querySelectorAll( '.fragment' ) ); |