website/reveal/js/reveal.js
/**
	 * Updates one dimension of slides by showing the slide
	 * with the specified index.
	 *
	 * @param {String} selector A CSS selector that will fetch
	 * the group of slides we are working with
	 * @param {Number} index The index of the slide that should be
	 * shown
	 *
	 * @return {Number} The index of the slide that is now shown,
	 * might differ from the passed in index if it was out of
	 * bounds.
	 */
Updates one dimension of slides by showing the slide
with the specified index.

@param {String} selector A CSS selector that will fetch
the group of slides we are working with
@param {Number} index The index of the slide that should be
shown

@return {Number} The index of the slide that is now shown,
might differ from the passed in index if it was out of
bounds.
Updates one dimension of slides by showing the slide with the specified index . @param { String } selector A CSS selector that will fetch the group of slides we are working with @param { Number } index The index of the slide that should be shown @return { Number } The index of the slide that is now shown might differ from the passed in index if it was out of bounds .
function updateSlides( selector, index ) {
		var slides = toArray( document.querySelectorAll( selector ) ),
			slidesLength = slides.length;
		if( slidesLength ) {
			if( config.loop ) {
				index %= slidesLength;
				if( index < 0 ) {
					index = slidesLength + index;
				}
			}
			index = Math.max( Math.min( index, slidesLength - 1 ), 0 );
			for( var i = 0; i < slidesLength; i++ ) {
				var element = slides[i];
				var reverse = config.rtl && !isVerticalSlide( element );
				element.classList.remove( 'past' );
				element.classList.remove( 'present' );
				element.classList.remove( 'future' );
				element.setAttribute( 'hidden', '' );
				if( i < index ) {
					element.classList.add( reverse ? 'future' : 'past' );
					var pastFragments = toArray( element.querySelectorAll( '.fragment' ) );
					while( pastFragments.length ) {
						var pastFragment = pastFragments.pop();
						pastFragment.classList.add( 'visible' );
						pastFragment.classList.remove( 'current-fragment' );
					}
				}
				else if( i > index ) {
					element.classList.add( reverse ? 'past' : 'future' );
					var futureFragments = toArray( element.querySelectorAll( '.fragment.visible' ) );
					while( futureFragments.length ) {
						var futureFragment = futureFragments.pop();
						futureFragment.classList.remove( 'visible' );
						futureFragment.classList.remove( 'current-fragment' );
					}
				}
				if( element.querySelector( 'section' ) ) {
					element.classList.add( 'stack' );
				}
			}
			slides[index].classList.add( 'present' );
			slides[index].removeAttribute( 'hidden' );
			var slideState = slides[index].getAttribute( 'data-state' );
			if( slideState ) {
				state = state.concat( slideState.split( ' ' ) );
			}
		}
		else {
			index = 0;
		}
		return index;
	}
function updateSlides ( selector , index ) { var slides = toArray ( document . querySelectorAll ( selector ) ) , slidesLength = slides . length ; if ( slidesLength ) { if ( config . loop ) { index %= slidesLength ; if ( index < 0 ) { index = slidesLength + index ; } } index = Math . max ( Math . min ( index , slidesLength - 1 ) , 0 ) ; for ( var i = 0 ; i < slidesLength ; i ++ ) { var element = slides [ i ] ; var reverse = config . rtl && ! isVerticalSlide ( element ) ; element . classList . remove ( 'past' ) ; element . classList . remove ( 'present' ) ; element . classList . remove ( 'future' ) ; element . setAttribute ( 'hidden' , '' ) ; if ( i < index ) { element . classList . add ( reverse ? 'future' : 'past' ) ; var pastFragments = toArray ( element . querySelectorAll ( '.fragment' ) ) ; while ( pastFragments . length ) { var pastFragment = pastFragments . pop ( ) ; pastFragment . classList . add ( 'visible' ) ; pastFragment . classList . remove ( 'current-fragment' ) ; } } else if ( i > index ) { element . classList . add ( reverse ? 'past' : 'future' ) ; var futureFragments = toArray ( element . querySelectorAll ( '.fragment.visible' ) ) ; while ( futureFragments . length ) { var futureFragment = futureFragments . pop ( ) ; futureFragment . classList . remove ( 'visible' ) ; futureFragment . classList . remove ( 'current-fragment' ) ; } } if ( element . querySelector ( 'section' ) ) { element . classList . add ( 'stack' ) ; } } slides [ index ] . classList . add ( 'present' ) ; slides [ index ] . removeAttribute ( 'hidden' ) ; var slideState = slides [ index ] . getAttribute ( 'data-state' ) ; if ( slideState ) { state = state . concat ( slideState . split ( ' ' ) ) ; } } else { index = 0 ; } return index ; }
Updates one dimension of slides by showing the slide
 with the specified index.
Updates one dimension of slides by showing the slide with the specified index .
// Select all slides and convert the NodeList result to // an array // Should the index loop? // Enforce max and minimum index bounds // http://www.w3.org/html/wg/drafts/html/master/editing.html#the-hidden-attribute // Any element previous to index is given the 'past' class // Show all fragments on prior slides // Any element subsequent to index is given the 'future' class // No fragments in future slides should be visible ahead of time // If this element contains vertical slides // Mark the current slide as present // If this slide has a state associated with it, add it // onto the current state of the deck // Since there are no slides we can't be anywhere beyond the // zeroth index