aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-04-27 15:39:11 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-04-27 15:39:11 +0200
commit7158c12effbce8a52c1a6385c1f9ee479c81c9fe (patch)
treea739de4cffb3b172f6d64257a8544eeb7395bda0 /js
parent0140a15bae7cd1c295bf6d64157fed3eaf065c0a (diff)
downloadfreenode-live-2017-presentation-7158c12effbce8a52c1a6385c1f9ee479c81c9fe.tar
freenode-live-2017-presentation-7158c12effbce8a52c1a6385c1f9ee479c81c9fe.tar.gz
lazy load all slide backgrounds
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js
index d0c8272..9b03d5a 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -528,6 +528,8 @@ var Reveal = (function(){
createBackground( slidev, backgroundStack );
}
+ backgroundStack.classList.add( 'stack' );
+
} );
} );
@@ -2279,8 +2281,14 @@ var Reveal = (function(){
*/
function showSlide( slide ) {
+ // Show the slide element
slide.style.display = 'block';
+ // Show the corresponding background element
+ var indices = getIndices( slide );
+ var background = getSlideBackground( indices.h, indices.v );
+ background.style.display = 'block';
+
// Media elements with data-src attributes
toArray( slide.querySelectorAll( 'img[data-src], video[data-src], audio[data-src], iframe[data-src]' ) ).forEach( function( element ) {
element.setAttribute( 'src', element.getAttribute( 'data-src' ) );
@@ -2312,8 +2320,14 @@ var Reveal = (function(){
*/
function hideSlide( slide ) {
+ // Hide the slide element
slide.style.display = 'none';
+ // Hide the corresponding background element
+ var indices = getIndices( slide );
+ var background = getSlideBackground( indices.h, indices.v );
+ background.style.display = 'none';
+
}
/**
@@ -2618,6 +2632,9 @@ var Reveal = (function(){
// Now that we know which the horizontal slide is, get its index
h = Math.max( horizontalSlides.indexOf( slideh ), 0 );
+ // Assume we're not vertical
+ v = 0;
+
// If this is a vertical slide, grab the vertical index
if( isVertical ) {
v = Math.max( toArray( slide.parentNode.querySelectorAll( 'section' ) ).indexOf( slide ), 0 );