浏览代码

Fixed issue with getProgress() when called from slidechanged event on edge case

Greg Denehy 7 年之前
父节点
当前提交
8579fc773d
共有 1 个文件被更改,包括 11 次插入10 次删除
  1. 11 10
      js/reveal.js

+ 11 - 10
js/reveal.js

@@ -2411,16 +2411,7 @@
 
 		// Dispatch an event if the slide changed
 		var slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore );
-		if( slideChanged ) {
-			dispatchEvent( 'slidechanged', {
-				'indexh': indexh,
-				'indexv': indexv,
-				'previousSlide': previousSlide,
-				'currentSlide': currentSlide,
-				'origin': o
-			} );
-		}
-		else {
+		if (!slideChanged) {
 			// Ensure that the previous slide is never the same as the current
 			previousSlide = null;
 		}
@@ -2448,6 +2439,16 @@
 			}
 		}
 
+		if( slideChanged ) {
+			dispatchEvent( 'slidechanged', {
+				'indexh': indexh,
+				'indexv': indexv,
+				'previousSlide': previousSlide,
+				'currentSlide': currentSlide,
+				'origin': o
+			} );
+		}
+
 		// Handle embedded content
 		if( slideChanged || !previousSlide ) {
 			stopEmbeddedContent( previousSlide );