fix issue where slide transitions were still running for auto-animated slides in Safari
This commit is contained in:
parent
34ab7ded55
commit
fe75be1cff
4
dist/reveal.min.js
vendored
4
dist/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
53
js/reveal.js
53
js/reveal.js
@ -1212,6 +1212,36 @@ export default function( revealElement, options ) {
|
|||||||
indexh = updateSlides( HORIZONTAL_SLIDES_SELECTOR, h === undefined ? indexh : h );
|
indexh = updateSlides( HORIZONTAL_SLIDES_SELECTOR, h === undefined ? indexh : h );
|
||||||
indexv = updateSlides( VERTICAL_SLIDES_SELECTOR, v === undefined ? indexv : v );
|
indexv = updateSlides( VERTICAL_SLIDES_SELECTOR, v === undefined ? indexv : v );
|
||||||
|
|
||||||
|
// Dispatch an event if the slide changed
|
||||||
|
let slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore );
|
||||||
|
|
||||||
|
// Ensure that the previous slide is never the same as the current
|
||||||
|
if( !slideChanged ) previousSlide = null;
|
||||||
|
|
||||||
|
// Find the current horizontal slide and any possible vertical slides
|
||||||
|
// within it
|
||||||
|
let currentHorizontalSlide = horizontalSlides[ indexh ],
|
||||||
|
currentVerticalSlides = currentHorizontalSlide.querySelectorAll( 'section' );
|
||||||
|
|
||||||
|
// Store references to the previous and current slides
|
||||||
|
currentSlide = currentVerticalSlides[ indexv ] || currentHorizontalSlide;
|
||||||
|
|
||||||
|
let autoAnimateTransition = false;
|
||||||
|
|
||||||
|
// Detect if we're moving between two auto-animated slides
|
||||||
|
if( slideChanged && previousSlide && currentSlide && !overview.isActive() ) {
|
||||||
|
// If this is an auto-animated transition, we disable the
|
||||||
|
// regular slide transition
|
||||||
|
//
|
||||||
|
// Note 20-03-2020:
|
||||||
|
// This needs to happen before we update slide visibility,
|
||||||
|
// otherwise transitions will still run in Safari.
|
||||||
|
if( previousSlide.hasAttribute( 'data-auto-animate' ) && currentSlide.hasAttribute( 'data-auto-animate' ) ) {
|
||||||
|
autoAnimateTransition = true;
|
||||||
|
dom.slides.classList.add( 'disable-slide-transitions' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update the visibility of slides now that the indices have changed
|
// Update the visibility of slides now that the indices have changed
|
||||||
updateSlidesVisibility();
|
updateSlidesVisibility();
|
||||||
|
|
||||||
@ -1222,26 +1252,11 @@ export default function( revealElement, options ) {
|
|||||||
overview.update();
|
overview.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the current horizontal slide and any possible vertical slides
|
|
||||||
// within it
|
|
||||||
let currentHorizontalSlide = horizontalSlides[ indexh ],
|
|
||||||
currentVerticalSlides = currentHorizontalSlide.querySelectorAll( 'section' );
|
|
||||||
|
|
||||||
// Store references to the previous and current slides
|
|
||||||
currentSlide = currentVerticalSlides[ indexv ] || currentHorizontalSlide;
|
|
||||||
|
|
||||||
// Show fragment, if specified
|
// Show fragment, if specified
|
||||||
if( typeof f !== 'undefined' ) {
|
if( typeof f !== 'undefined' ) {
|
||||||
fragments.goto( f );
|
fragments.goto( f );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch an event if the slide changed
|
|
||||||
let slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore );
|
|
||||||
if (!slideChanged) {
|
|
||||||
// Ensure that the previous slide is never the same as the current
|
|
||||||
previousSlide = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Solves an edge case where the previous slide maintains the
|
// Solves an edge case where the previous slide maintains the
|
||||||
// 'present' class when navigating between adjacent vertical
|
// 'present' class when navigating between adjacent vertical
|
||||||
// stacks
|
// stacks
|
||||||
@ -1318,12 +1333,7 @@ export default function( revealElement, options ) {
|
|||||||
cueAutoSlide();
|
cueAutoSlide();
|
||||||
|
|
||||||
// Auto-animation
|
// Auto-animation
|
||||||
if( slideChanged && previousSlide && currentSlide && !overview.isActive() ) {
|
if( autoAnimateTransition ) {
|
||||||
|
|
||||||
// Skip the slide transition between our two slides
|
|
||||||
// when auto-animating individual elements
|
|
||||||
if( previousSlide.hasAttribute( 'data-auto-animate' ) && currentSlide.hasAttribute( 'data-auto-animate' ) ) {
|
|
||||||
dom.slides.classList.add( 'disable-slide-transitions' );
|
|
||||||
|
|
||||||
setTimeout( () => {
|
setTimeout( () => {
|
||||||
dom.slides.classList.remove( 'disable-slide-transitions' );
|
dom.slides.classList.remove( 'disable-slide-transitions' );
|
||||||
@ -1333,7 +1343,6 @@ export default function( revealElement, options ) {
|
|||||||
// Run the auto-animation between our slides
|
// Run the auto-animation between our slides
|
||||||
autoAnimate.run( previousSlide, currentSlide );
|
autoAnimate.run( previousSlide, currentSlide );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user