From d3ebbf1be72dc1ea17c7c6e48f8c362feb4deb94 Mon Sep 17 00:00:00 2001 From: Chris Lawrence Date: Sat, 8 Jun 2013 05:45:48 -0400 Subject: [PATCH] Only call embedded content bits if the slide actually changed. --- js/reveal.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index a4a71db..8e5fd98 100644 --- a/js/reveal.js +++ b/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(); -- 2.26.2