avoid creating duplicate auto-slide controls #770

This commit is contained in:
Hakim El Hattab 2014-02-16 17:37:59 +01:00
parent 2aef97584a
commit 26e9ce1ff7
2 changed files with 9 additions and 7 deletions

View file

@ -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 ) {

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long