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 = Array.prototype.slice.call( 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];
				if( isOverviewActive() === false ) {
					var distance = Math.abs( ( index - i ) % ( slidesLength - 3 ) ) || 0;
					element.style.display = distance > 3 ? 'none' : 'block';
				}
				slides[i].classList.remove( 'past' );
				slides[i].classList.remove( 'present' );
				slides[i].classList.remove( 'future' );
				if( i < index ) {
					slides[i].classList.add( 'past' );
				}
				else if( i > index ) {
					slides[i].classList.add( 'future' );
				}
				if( element.querySelector( 'section' ) ) {
					slides[i].classList.add( 'stack' );
				}
			}
			slides[index].classList.add( 'present' );
			var slideState = slides[index].getAttribute( 'data-state' );
			if( slideState ) {
				state = state.concat( slideState.split( ' ' ) );
			}
			var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' );
			if( slideAutoSlide ) {
				autoSlide = parseInt( slideAutoSlide );
			} else {
				autoSlide = config.autoSlide
			}
		}
		else {
			index = 0;
		}
		return index;
	}
function updateSlides ( selector , index ) { var slides = Array . prototype . slice . call ( 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 ] ; if ( isOverviewActive ( ) === false ) { var distance = Math . abs ( ( index - i ) % ( slidesLength - 3 ) ) || 0 ; element . style . display = distance > 3 ? 'none' : 'block' ; } slides [ i ] . classList . remove ( 'past' ) ; slides [ i ] . classList . remove ( 'present' ) ; slides [ i ] . classList . remove ( 'future' ) ; if ( i < index ) { slides [ i ] . classList . add ( 'past' ) ; } else if ( i > index ) { slides [ i ] . classList . add ( 'future' ) ; } if ( element . querySelector ( 'section' ) ) { slides [ i ] . classList . add ( 'stack' ) ; } } slides [ index ] . classList . add ( 'present' ) ; var slideState = slides [ index ] . getAttribute ( 'data-state' ) ; if ( slideState ) { state = state . concat ( slideState . split ( ' ' ) ) ; } var slideAutoSlide = slides [ index ] . getAttribute ( 'data-autoslide' ) ; if ( slideAutoSlide ) { autoSlide = parseInt ( slideAutoSlide ) ; } else { autoSlide = config . autoSlide } } 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 // Optimization; hide all slides that are three or more steps // away from the present slide // The distance loops so that it measures 1 between the first // and last slides // Any element previous to index is given the 'past' class // Any element subsequent to index is given the 'future' class // 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 // If this slide has a data-autoslide attribtue associated use this as // autoSlide value otherwise use the global configured time // Since there are no slides we can't be anywhere beyond the // zeroth index