website/reveal/js/reveal.js
/**
	 * Navigate to the specified slide fragment.
	 *
	 * @param {Number} index The index of the fragment that
	 * should be shown, -1 means all are invisible
	 * @param {Number} offset Integer offset to apply to the
	 * fragment index
	 *
	 * @return {Boolean} true if a change was made in any
	 * fragments visibility as part of this call
	 */
Navigate to the specified slide fragment.
@param {Number} index The index of the fragment that
should be shown, -1 means all are invisible
@param {Number} offset Integer offset to apply to the
fragment index

@return {Boolean} true if a change was made in any
fragments visibility as part of this call
Navigate to the specified slide fragment . @param { Number } index The index of the fragment that should be shown - 1 means all are invisible @param { Number } offset Integer offset to apply to the fragment index @return { Boolean } true if a change was made in any fragments visibility as part of this call
function navigateFragment( index, offset ) {
		if( currentSlide && config.fragments ) {
			var fragments = sortFragments( currentSlide.querySelectorAll( '.fragment' ) );
			if( fragments.length ) {
				if( typeof index !== 'number' ) {
					var lastVisibleFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop();
					if( lastVisibleFragment ) {
						index = parseInt( lastVisibleFragment.getAttribute( 'data-fragment-index' ) || 0, 10 );
					}
					else {
						index = -1;
					}
				}
				if( typeof offset === 'number' ) {
					index += offset;
				}
				var fragmentsShown = [],
					fragmentsHidden = [];
				toArray( fragments ).forEach( function( element, i ) {
					if( element.hasAttribute( 'data-fragment-index' ) ) {
						i = parseInt( element.getAttribute( 'data-fragment-index' ), 10 );
					}
					if( i <= index ) {
						if( !element.classList.contains( 'visible' ) ) fragmentsShown.push( element );
						element.classList.add( 'visible' );
						element.classList.remove( 'current-fragment' );
						if( i === index ) {
							element.classList.add( 'current-fragment' );
						}
					}
					else {
						if( element.classList.contains( 'visible' ) ) fragmentsHidden.push( element );
						element.classList.remove( 'visible' );
						element.classList.remove( 'current-fragment' );
					}
				} );
				if( fragmentsHidden.length ) {
					dispatchEvent( 'fragmenthidden', { fragment: fragmentsHidden[0], fragments: fragmentsHidden } );
				}
				if( fragmentsShown.length ) {
					dispatchEvent( 'fragmentshown', { fragment: fragmentsShown[0], fragments: fragmentsShown } );
				}
				updateControls();
				return !!( fragmentsShown.length || fragmentsHidden.length );
			}
		}
		return false;
	}
function navigateFragment ( index , offset ) { if ( currentSlide && config . fragments ) { var fragments = sortFragments ( currentSlide . querySelectorAll ( '.fragment' ) ) ; if ( fragments . length ) { if ( typeof index !== 'number' ) { var lastVisibleFragment = sortFragments ( currentSlide . querySelectorAll ( '.fragment.visible' ) ) . pop ( ) ; if ( lastVisibleFragment ) { index = parseInt ( lastVisibleFragment . getAttribute ( 'data-fragment-index' ) || 0 , 10 ) ; } else { index = - 1 ; } } if ( typeof offset === 'number' ) { index += offset ; } var fragmentsShown = [ ] , fragmentsHidden = [ ] ; toArray ( fragments ) . forEach ( function ( element , i ) { if ( element . hasAttribute ( 'data-fragment-index' ) ) { i = parseInt ( element . getAttribute ( 'data-fragment-index' ) , 10 ) ; } if ( i <= index ) { if ( ! element . classList . contains ( 'visible' ) ) fragmentsShown . push ( element ) ; element . classList . add ( 'visible' ) ; element . classList . remove ( 'current-fragment' ) ; if ( i === index ) { element . classList . add ( 'current-fragment' ) ; } } else { if ( element . classList . contains ( 'visible' ) ) fragmentsHidden . push ( element ) ; element . classList . remove ( 'visible' ) ; element . classList . remove ( 'current-fragment' ) ; } } ) ; if ( fragmentsHidden . length ) { dispatchEvent ( 'fragmenthidden' , { fragment : fragmentsHidden [ 0 ] , fragments : fragmentsHidden } ) ; } if ( fragmentsShown . length ) { dispatchEvent ( 'fragmentshown' , { fragment : fragmentsShown [ 0 ] , fragments : fragmentsShown } ) ; } updateControls ( ) ; return ! ! ( fragmentsShown . length || fragmentsHidden . length ) ; } } return false ; }
Navigate to the specified slide fragment.
Navigate to the specified slide fragment .
// If no index is specified, find the current // If an offset is specified, apply it to the index // Visible fragments // Hidden fragments