MCPcopy
hub / github.com/hakimel/reveal.js / setProgressBarValue

Method setProgressBarValue

js/controllers/scrollview.js:675–695  ·  view source on GitHub ↗

* Moves the progress bar playhead to the specified position. * * @param {number} progress 0-1

( progress )

Source from the content-addressed store, hash-verified

673 * @param {number} progress 0-1
674 */
675 setProgressBarValue( progress ) {
676
677 if( this.progressBar ) {
678
679 this.progressBarPlayhead.style.transform = `translateY(${progress * this.progressBarScrollableHeight}px)`;
680
681 this.getAllPages()
682 .filter( page => page.progressBarSlide )
683 .forEach( ( page ) => {
684 page.progressBarSlide.classList.toggle( 'active', page.active === true );
685
686 page.scrollTriggers.forEach( ( trigger, i ) => {
687 page.scrollTriggerElements[i].classList.toggle( 'active', page.active === true && trigger.active === true );
688 } );
689 } );
690
691 this.showProgressBar();
692
693 }
694
695 }
696
697 /**
698 * Show the progress bar and, if configured, automatically hide

Callers 1

syncScrollPositionMethod · 0.95

Calls 3

getAllPagesMethod · 0.95
showProgressBarMethod · 0.95
toggleMethod · 0.65

Tested by

no test coverage detected