diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-02-02 09:14:09 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-02-02 09:14:09 +0100 |
commit | 1c8a6e47a6374332caeb62ae84ca109ec59be54a (patch) | |
tree | ba9de8640b9f5a5445a4b2d5d616731aa2922603 /js | |
parent | 49f462e6ce329b9c569d4735ab617ac07385b17b (diff) | |
download | fosdem-2018-presentation-1c8a6e47a6374332caeb62ae84ca109ec59be54a.tar fosdem-2018-presentation-1c8a6e47a6374332caeb62ae84ca109ec59be54a.tar.gz |
only preload last slides if presentation is looped
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/js/reveal.js b/js/reveal.js index afbfb6e..dbe3679 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2359,7 +2359,7 @@ viewDistance = isOverview() ? 6 : 2; } - // Limit view distance on weaker devices + // All slides need to be visible when exporting to PDF if( isPrintingPDF() ) { viewDistance = Number.MAX_VALUE; } @@ -2370,8 +2370,14 @@ var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ), verticalSlidesLength = verticalSlides.length; - // Loops so that it measures 1 between the first and last slides - distanceX = Math.abs( ( ( indexh || 0 ) - x ) % ( horizontalSlidesLength - viewDistance ) ) || 0; + // Determine how far away this slide is from the present + distanceX = Math.abs( ( indexh || 0 ) - x ) || 0; + + // If the presentation is looped, distance should measure + // 1 between the first and last slides + if( config.loop ) { + distanceX = distanceX % ( horizontalSlidesLength - viewDistance ); + } // Show the horizontal slide if it's within the view distance if( distanceX < viewDistance ) { |