Ver Fonte

Only call embedded content bits if the slide actually changed.

Chris Lawrence há 11 anos atrás
pai
commit
d3ebbf1be7
1 ficheiros alterados com 6 adições e 3 exclusões
  1. 6 3
      js/reveal.js

+ 6 - 3
js/reveal.js

@@ -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();