Sfoglia il codice sorgente

avoid creating duplicate auto-slide controls #770

Hakim El Hattab 11 anni fa
parent
commit
26e9ce1ff7
2 ha cambiato i file con 8 aggiunte e 6 eliminazioni
  1. 7 5
      js/reveal.js
  2. 1 1
      js/reveal.min.js

+ 7 - 5
js/reveal.js

@@ -591,7 +591,13 @@ var Reveal = (function(){
 			enablePreviewLinks( '[data-preview-link]' );
 		}
 
-		// Auto-slide playback controls
+		// Remove existing auto-slide controls
+		if( autoSlidePlayer ) {
+			autoSlidePlayer.destroy();
+			autoSlidePlayer = null;
+		}
+
+		// Generate auto-slide controls if needed
 		if( numberOfSlides > 1 && config.autoSlide && config.autoSlideStoppable && features.canvas && features.requestAnimationFrame ) {
 			autoSlidePlayer = new Playback( dom.wrapper, function() {
 				return Math.min( Math.max( ( Date.now() - autoSlideStartTime ) / autoSlide, 0 ), 1 );
@@ -600,10 +606,6 @@ var Reveal = (function(){
 			autoSlidePlayer.on( 'click', onAutoSlidePlayerClick );
 			autoSlidePaused = false;
 		}
-		else if( autoSlidePlayer ) {
-			autoSlidePlayer.destroy();
-			autoSlidePlayer = null;
-		}
 
 		// Load the theme in the config, if it's not already loaded
 		if( config.theme && dom.theme ) {

File diff suppressed because it is too large
+ 1 - 1
js/reveal.min.js


Some files were not shown because too many files changed in this diff