Commit 35db006c authored by Hakim El Hattab's avatar Hakim El Hattab
Browse files

fix overlapping ids when auto-animating multiple presentations in same window

parent cd5161ff
This diff is collapsed.
This diff is collapsed.
import { queryAll, extend, createStyleSheet } from '../utils/util.js'
import { FRAGMENT_STYLE_REGEX } from '../utils/constants.js'
// Counter used to generate unique IDs for auto-animated elements
let autoAnimateCounter = 0;
/**
* Automatically animates matching elements across
* slides with the [data-auto-animate] attribute.
......@@ -11,9 +14,6 @@ export default class AutoAnimate {
this.Reveal = Reveal;
// Counter used to generate unique IDs for auto-animated elements
this.autoAnimateCounter = 0;
}
/**
......@@ -45,7 +45,7 @@ export default class AutoAnimate {
// Inject our auto-animate styles for this transition
let css = this.getAutoAnimatableElements( fromSlide, toSlide ).map( elements => {
return this.autoAnimateElements( elements.from, elements.to, elements.options || {}, animationOptions, this.autoAnimateCounter++ );
return this.autoAnimateElements( elements.from, elements.to, elements.options || {}, animationOptions, autoAnimateCounter++ );
} );
// Animate unmatched elements, if enabled
......@@ -63,7 +63,7 @@ export default class AutoAnimate {
// If there is a duration or delay set specifically for this
// element our unmatched elements should adhere to those
if( unmatchedOptions.duration !== animationOptions.duration || unmatchedOptions.delay !== animationOptions.delay ) {
id = 'unmatched-' + this.autoAnimateCounter++;
id = 'unmatched-' + autoAnimateCounter++;
css.push( `[data-auto-animate="running"] [data-auto-animate-target="${id}"] { transition: opacity ${unmatchedOptions.duration}s ease ${unmatchedOptions.delay}s; }` );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment