Only call embedded content bits if the slide actually changed.
authorChris Lawrence <lawrencc@debian.org>
Sat, 8 Jun 2013 09:45:48 +0000 (05:45 -0400)
committerChris Lawrence <lawrencc@debian.org>
Sat, 8 Jun 2013 09:45:48 +0000 (05:45 -0400)
js/reveal.js

index a4a71db49240dc5be52e95a39c91c4f64d318bda..8e5fd9831742f20da3f69fa4eae8ba0a46c6375a 100644 (file)
@@ -1128,7 +1128,8 @@ var Reveal = (function(){
                }
 
                // Dispatch an event if the slide changed
-               if( indexh !== indexhBefore || indexv !== indexvBefore ) {
+               var slideChanged = (indexh !== indexhBefore || indexv !== indexvBefore);
+               if( slideChanged ) {
                        dispatchEvent( 'slidechanged', {
                                'indexh': indexh,
                                'indexv': indexv,
@@ -1165,8 +1166,10 @@ var Reveal = (function(){
                }
 
                // Handle embedded content
-               stopEmbeddedContent( previousSlide );
-               startEmbeddedContent( currentSlide );
+               if (slideChanged) {
+                       stopEmbeddedContent( previousSlide );
+                       startEmbeddedContent( currentSlide );
+               }
 
                updateControls();
                updateProgress();