From d9513b34d58da2e744719f6cc78c1bf99c2aa601 Mon Sep 17 00:00:00 2001 From: Cristiano Cortezia Date: Thu, 16 Jan 2014 14:44:32 -0200 Subject: [PATCH] Fixes bad NaN applied to style on updateParallax. The previous criteria "verticalSlideCount > 0" would result in verticalOffset being NaN when verticalSlideCount == 1. This would cause dom.background.style.backgroundPosition to be set to something like "123px NaNpx", ultimately preventing the parallax effect to play (silently failing so far). --- js/reveal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/reveal.js b/js/reveal.js index 98d802e4..b7764d34 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2032,7 +2032,7 @@ var Reveal = (function(){ var slideHeight = dom.background.offsetHeight; var verticalSlideCount = verticalSlides.length; - var verticalOffset = verticalSlideCount > 0 ? -( backgroundHeight - slideHeight ) / ( verticalSlideCount-1 ) * indexv : 0; + var verticalOffset = verticalSlideCount > 1 ? -( backgroundHeight - slideHeight ) / ( verticalSlideCount-1 ) * indexv : 0; dom.background.style.backgroundPosition = horizontalOffset + 'px ' + verticalOffset + 'px';