diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2013-09-15 14:58:41 -0400 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2013-09-15 14:58:41 -0400 |
commit | 36061b43bacb49ca83ebcbb8d419e36548439640 (patch) | |
tree | bd4b0064ea85ef0c3779cb71a5d4761aa5a646fe /js/reveal.js | |
parent | 8399e828dbe2f2ac689d32251b8dceed91b76d68 (diff) | |
download | fosdem-2018-presentation-36061b43bacb49ca83ebcbb8d419e36548439640.tar fosdem-2018-presentation-36061b43bacb49ca83ebcbb8d419e36548439640.tar.gz |
update the parallax background when the window resizes #595
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/js/reveal.js b/js/reveal.js index 7983099..f962f51 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1080,6 +1080,7 @@ var Reveal = (function(){ } updateProgress(); + updateParallax(); } @@ -1890,9 +1891,8 @@ var Reveal = (function(){ // Animate parallax background if( dom.wrapper.getAttribute( 'data-parallax-background' ) || config.parallaxBackgroundImage ) { - var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ); - var currentHorizontalSlide = horizontalSlides[ indexh ], - currentVerticalSlides = currentHorizontalSlide.querySelectorAll( 'section' ); + var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ), + verticalSlides = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR ); var backgroundSize = dom.wrapper.style.backgroundSize.split( ' ' ), backgroundWidth, backgroundHeight; @@ -1905,13 +1905,12 @@ var Reveal = (function(){ backgroundHeight = parseInt( backgroundSize[1], 10 ); } - var slideWidth = dom.wrapper.offsetWidth; var horizontalSlideCount = horizontalSlides.length; var horizontalOffset = -( backgroundWidth - slideWidth ) / ( horizontalSlideCount-1 ) * indexh; var slideHeight = dom.wrapper.offsetHeight; - var verticalSlideCount = currentVerticalSlides.length; + var verticalSlideCount = verticalSlides.length; var verticalOffset = verticalSlideCount > 0 ? -( backgroundHeight - slideHeight ) / ( verticalSlideCount-1 ) * indexv : 0; dom.wrapper.style.backgroundPosition = horizontalOffset + 'px ' + verticalOffset + 'px'; |