Browse Source

new syncFragments api method

Hakim El Hattab 6 năm trước cách đây
mục cha
commit
4672801229
1 tập tin đã thay đổi với 16 bổ sung2 xóa
  1. 16 2
      js/reveal.js

+ 16 - 2
js/reveal.js

@@ -2682,8 +2682,7 @@
 	function syncSlide( slide ) {
 
 		syncBackground( slide );
-
-		sortFragments( slide.querySelectorAll( '.fragment' ) );
+		syncFragments( slide );
 
 		updateBackground();
 		updateNotes();
@@ -2692,6 +2691,19 @@
 
 	}
 
+	/**
+	 * Formats the fragments on the given slide so that they have
+	 * valid indices. Call this if fragments are changed in the DOM
+	 * after reveal.js has already initialized.
+	 *
+	 * @param {HTMLElement} slide
+	 */
+	function syncFragments( slide ) {
+
+		sortFragments( slide.querySelectorAll( '.fragment' ) );
+
+	}
+
 	/**
 	 * Resets all vertical slides so that only the first
 	 * is visible.
@@ -5297,8 +5309,10 @@
 
 		initialize: initialize,
 		configure: configure,
+
 		sync: sync,
 		syncSlide: syncSlide,
+		syncFragments: syncFragments,
 
 		// Navigation methods
 		slide: slide,