Skip to content

Commit

Permalink
auto-animate no longer skips matching fragments on adjacent slides
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Nov 28, 2024
1 parent 0d02d8a commit 6dea2a5
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions js/controllers/autoanimate.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,28 +178,12 @@ export default class AutoAnimate {
let fromProps = this.getAutoAnimatableProperties( 'from', from, elementOptions ),
toProps = this.getAutoAnimatableProperties( 'to', to, elementOptions );

// Maintain fragment visibility for matching elements when
// we're navigating forwards, this way the viewer won't need
// to step through the same fragments twice
if( to.classList.contains( 'fragment' ) ) {

// Don't auto-animate the opacity of fragments to avoid
// conflicts with fragment animations
delete toProps.styles['opacity'];

if( from.classList.contains( 'fragment' ) ) {

let fromFragmentStyle = ( from.className.match( FRAGMENT_STYLE_REGEX ) || [''] )[0];
let toFragmentStyle = ( to.className.match( FRAGMENT_STYLE_REGEX ) || [''] )[0];

// Only skip the fragment if the fragment animation style
// remains unchanged
if( fromFragmentStyle === toFragmentStyle && animationOptions.slideDirection === 'forward' ) {
to.classList.add( 'visible', 'disabled' );
}

}

}

// If translation and/or scaling are enabled, css transform
Expand Down Expand Up @@ -471,7 +455,7 @@ export default class AutoAnimate {

// Text
this.findAutoAnimateMatches( pairs, fromSlide, toSlide, textNodes, node => {
return node.nodeName + ':::' + node.innerText;
return node.nodeName + ':::' + node.textContent.trim();
} );

// Media
Expand All @@ -481,7 +465,7 @@ export default class AutoAnimate {

// Code
this.findAutoAnimateMatches( pairs, fromSlide, toSlide, codeNodes, node => {
return node.nodeName + ':::' + node.innerText;
return node.nodeName + ':::' + node.textContent.trim();
} );

pairs.forEach( pair => {
Expand Down

0 comments on commit 6dea2a5

Please sign in to comment.