Skip to content

Commit 4672801

Browse files
committed
new syncFragments api method
1 parent 30b670c commit 4672801

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

js/reveal.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,8 +2682,7 @@
26822682
function syncSlide( slide ) {
26832683

26842684
syncBackground( slide );
2685-
2686-
sortFragments( slide.querySelectorAll( '.fragment' ) );
2685+
syncFragments( slide );
26872686

26882687
updateBackground();
26892688
updateNotes();
@@ -2692,6 +2691,19 @@
26922691

26932692
}
26942693

2694+
/**
2695+
* Formats the fragments on the given slide so that they have
2696+
* valid indices. Call this if fragments are changed in the DOM
2697+
* after reveal.js has already initialized.
2698+
*
2699+
* @param {HTMLElement} slide
2700+
*/
2701+
function syncFragments( slide ) {
2702+
2703+
sortFragments( slide.querySelectorAll( '.fragment' ) );
2704+
2705+
}
2706+
26952707
/**
26962708
* Resets all vertical slides so that only the first
26972709
* is visible.
@@ -5297,8 +5309,10 @@
52975309

52985310
initialize: initialize,
52995311
configure: configure,
5312+
53005313
sync: sync,
53015314
syncSlide: syncSlide,
5315+
syncFragments: syncFragments,
53025316

53035317
// Navigation methods
53045318
slide: slide,

0 commit comments

Comments
 (0)