Commit a03e8036 authored by Hakim El Hattab's avatar Hakim El Hattab
Browse files

make it possible to load/unload slides via the api

parent 4022cbfe
......@@ -2748,10 +2748,10 @@
// Show the horizontal slide if it's within the view distance
if( distanceX < viewDistance ) {
showSlide( horizontalSlide );
loadSlide( horizontalSlide );
}
else {
hideSlide( horizontalSlide );
unloadSlide( horizontalSlide );
}
if( verticalSlidesLength ) {
......@@ -2764,10 +2764,10 @@
distanceY = x === ( indexh || 0 ) ? Math.abs( ( indexv || 0 ) - y ) : Math.abs( y - oy );
if( distanceX + distanceY < viewDistance ) {
showSlide( verticalSlide );
loadSlide( verticalSlide );
}
else {
hideSlide( verticalSlide );
unloadSlide( verticalSlide );
}
}
......@@ -3166,14 +3166,9 @@
*
* @param {HTMLElement} slide Slide to show
*/
/**
* Called when the given slide is within the configured view
* distance. Shows the slide element and loads any content
* that is set to load lazily (data-src).
*
* @param {HTMLElement} slide Slide to show
*/
function showSlide( slide ) {
function loadSlide( slide, options ) {
options = options || {};
// Show the slide element
slide.style.display = config.display;
......@@ -3253,7 +3248,7 @@
background.appendChild( video );
}
// Iframes
else if( backgroundIframe ) {
else if( backgroundIframe && options.excludeIframes !== true ) {
var iframe = document.createElement( 'iframe' );
iframe.setAttribute( 'allowfullscreen', '' );
iframe.setAttribute( 'mozallowfullscreen', '' );
......@@ -3282,12 +3277,12 @@
}
/**
* Called when the given slide is moved outside of the
* configured view distance.
* Unloads and hides the given slide. This is called when the
* slide is moved outside of the configured view distance.
*
* @param {HTMLElement} slide
*/
function hideSlide( slide ) {
function unloadSlide( slide ) {
// Hide the slide element
slide.style.display = 'none';
......@@ -5117,6 +5112,10 @@
isAutoSliding: isAutoSliding,
isSpeakerNotes: isSpeakerNotes,
// Slide preloading
loadSlide: loadSlide,
unloadSlide: unloadSlide,
// Adds or removes all internal event listeners (such as keyboard)
addEventListeners: addEventListeners,
removeEventListeners: removeEventListeners,
......
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