Skip to content

Commit 35db006

Browse files
committed
fix overlapping ids when auto-animating multiple presentations in same window
1 parent cd5161f commit 35db006

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

dist/reveal.esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/reveal.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/controllers/autoanimate.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { queryAll, extend, createStyleSheet } from '../utils/util.js'
22
import { FRAGMENT_STYLE_REGEX } from '../utils/constants.js'
33

4+
// Counter used to generate unique IDs for auto-animated elements
5+
let autoAnimateCounter = 0;
6+
47
/**
58
* Automatically animates matching elements across
69
* slides with the [data-auto-animate] attribute.
@@ -11,9 +14,6 @@ export default class AutoAnimate {
1114

1215
this.Reveal = Reveal;
1316

14-
// Counter used to generate unique IDs for auto-animated elements
15-
this.autoAnimateCounter = 0;
16-
1717
}
1818

1919
/**
@@ -45,7 +45,7 @@ export default class AutoAnimate {
4545

4646
// Inject our auto-animate styles for this transition
4747
let css = this.getAutoAnimatableElements( fromSlide, toSlide ).map( elements => {
48-
return this.autoAnimateElements( elements.from, elements.to, elements.options || {}, animationOptions, this.autoAnimateCounter++ );
48+
return this.autoAnimateElements( elements.from, elements.to, elements.options || {}, animationOptions, autoAnimateCounter++ );
4949
} );
5050

5151
// Animate unmatched elements, if enabled
@@ -63,7 +63,7 @@ export default class AutoAnimate {
6363
// If there is a duration or delay set specifically for this
6464
// element our unmatched elements should adhere to those
6565
if( unmatchedOptions.duration !== animationOptions.duration || unmatchedOptions.delay !== animationOptions.delay ) {
66-
id = 'unmatched-' + this.autoAnimateCounter++;
66+
id = 'unmatched-' + autoAnimateCounter++;
6767
css.push( `[data-auto-animate="running"] [data-auto-animate-target="${id}"] { transition: opacity ${unmatchedOptions.duration}s ease ${unmatchedOptions.delay}s; }` );
6868
}
6969

0 commit comments

Comments
 (0)