only run vertical slide setup during startup #726

This commit is contained in:
Hakim El Hattab 2013-11-28 09:35:04 -05:00
parent b314cf7b27
commit f7b612b1e4
2 changed files with 32 additions and 10 deletions

View File

@ -316,8 +316,8 @@ var Reveal = (function(){
// Make sure we've got all the DOM elements we need // Make sure we've got all the DOM elements we need
setupDOM(); setupDOM();
// Decorate the slide DOM elements with state classes (past/future) // Resets all vertical slides so that only the first is visible
formatSlides(); resetVerticalSlides();
// Updates the presentation to match the current configuration values // Updates the presentation to match the current configuration values
configure(); configure();
@ -1603,7 +1603,7 @@ var Reveal = (function(){
// Re-create the slide backgrounds // Re-create the slide backgrounds
createBackgrounds(); createBackgrounds();
formatSlides(); sortAllFragments();
updateControls(); updateControls();
updateProgress(); updateProgress();
@ -1613,10 +1613,10 @@ var Reveal = (function(){
} }
/** /**
* Iterates through and decorates slides DOM elements with * Resets all vertical slides so that only the first
* appropriate classes. * is visible.
*/ */
function formatSlides() { function resetVerticalSlides() {
var horizontalSlides = toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); var horizontalSlides = toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
horizontalSlides.forEach( function( horizontalSlide ) { horizontalSlides.forEach( function( horizontalSlide ) {
@ -1624,7 +1624,29 @@ var Reveal = (function(){
var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ); var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) );
verticalSlides.forEach( function( verticalSlide, y ) { 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' ) ); sortFragments( verticalSlide.querySelectorAll( '.fragment' ) );

6
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long