avoid creating duplicate auto-slide controls #770
This commit is contained in:
		
							
								
								
									
										12
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -591,7 +591,13 @@ var Reveal = (function(){ | |||||||
| 			enablePreviewLinks( '[data-preview-link]' ); | 			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 ) { | 		if( numberOfSlides > 1 && config.autoSlide && config.autoSlideStoppable && features.canvas && features.requestAnimationFrame ) { | ||||||
| 			autoSlidePlayer = new Playback( dom.wrapper, function() { | 			autoSlidePlayer = new Playback( dom.wrapper, function() { | ||||||
| 				return Math.min( Math.max( ( Date.now() - autoSlideStartTime ) / autoSlide, 0 ), 1 ); | 				return Math.min( Math.max( ( Date.now() - autoSlideStartTime ) / autoSlide, 0 ), 1 ); | ||||||
| @@ -600,10 +606,6 @@ var Reveal = (function(){ | |||||||
| 			autoSlidePlayer.on( 'click', onAutoSlidePlayerClick ); | 			autoSlidePlayer.on( 'click', onAutoSlidePlayerClick ); | ||||||
| 			autoSlidePaused = false; | 			autoSlidePaused = false; | ||||||
| 		} | 		} | ||||||
| 		else if( autoSlidePlayer ) { |  | ||||||
| 			autoSlidePlayer.destroy(); |  | ||||||
| 			autoSlidePlayer = null; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		// Load the theme in the config, if it's not already loaded | 		// Load the theme in the config, if it's not already loaded | ||||||
| 		if( config.theme && dom.theme ) { | 		if( config.theme && dom.theme ) { | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								js/reveal.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								js/reveal.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user