reconfiguring no longer unloads iframes on current slide
This commit is contained in:
parent
376d140b2a
commit
3d1d7683b2
15
js/reveal.js
15
js/reveal.js
@ -1274,6 +1274,8 @@
|
|||||||
a[ i ] = b[ i ];
|
a[ i ] = b[ i ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return a;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2509,7 +2511,7 @@
|
|||||||
|
|
||||||
// Start or stop embedded content depending on global config
|
// Start or stop embedded content depending on global config
|
||||||
if( config.autoPlayMedia === false ) {
|
if( config.autoPlayMedia === false ) {
|
||||||
stopEmbeddedContent( currentSlide );
|
stopEmbeddedContent( currentSlide, { unloadIframes: false } );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
startEmbeddedContent( currentSlide );
|
startEmbeddedContent( currentSlide );
|
||||||
@ -3535,7 +3537,12 @@
|
|||||||
*
|
*
|
||||||
* @param {HTMLElement} element
|
* @param {HTMLElement} element
|
||||||
*/
|
*/
|
||||||
function stopEmbeddedContent( element ) {
|
function stopEmbeddedContent( element, options ) {
|
||||||
|
|
||||||
|
options = extend( {
|
||||||
|
// Defaults
|
||||||
|
unloadIframes: true
|
||||||
|
}, options || {} );
|
||||||
|
|
||||||
if( element && element.parentNode ) {
|
if( element && element.parentNode ) {
|
||||||
// HTML5 media elements
|
// HTML5 media elements
|
||||||
@ -3566,7 +3573,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Lazy loading iframes
|
if( options.unloadIframes === true ) {
|
||||||
|
// Unload lazy-loaded iframes
|
||||||
toArray( element.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) {
|
toArray( element.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) {
|
||||||
// Only removing the src doesn't actually unload the frame
|
// Only removing the src doesn't actually unload the frame
|
||||||
// in all browsers (Firefox) so we set it to blank first
|
// in all browsers (Firefox) so we set it to blank first
|
||||||
@ -3574,6 +3582,7 @@
|
|||||||
el.removeAttribute( 'src' );
|
el.removeAttribute( 'src' );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user