From 3b40dcabf432960407b7d41eae36850b2e560d6e Mon Sep 17 00:00:00 2001 From: therufa Date: Wed, 23 Aug 2017 11:06:54 +0200 Subject: [PATCH] Reveal: Add the possibility to disable the vOffset I added the possibility to entirely disable the vOffset on the component, so there is no need in the style layer to force-override it. --- js/foundation.reveal.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/js/foundation.reveal.js b/js/foundation.reveal.js index e02ace43e..f8e029556 100644 --- a/js/foundation.reveal.js +++ b/js/foundation.reveal.js @@ -109,7 +109,7 @@ class Reveal extends Plugin { var outerWidth = $(window).width(); var height = this.$element.outerHeight(); var outerHeight = $(window).height(); - var left, top; + var left, top = null; if (this.options.hOffset === 'auto') { left = parseInt((outerWidth - width) / 2, 10); } else { @@ -121,13 +121,17 @@ class Reveal extends Plugin { } else { top = parseInt((outerHeight - height) / 4, 10); } - } else { + } else if (this.options.vOffset !== null) { top = parseInt(this.options.vOffset, 10); } - this.$element.css({top: top + 'px'}); - // only worry about left if we don't have an overlay or we havea horizontal offset, + + if (top !== null) { + this.$element.css({top: top + 'px'}); + } + + // only worry about left if we don't have an overlay or we have a horizontal offset, // otherwise we're perfectly in the middle - if(!this.$overlay || (this.options.hOffset !== 'auto')) { + if (!this.$overlay || (this.options.hOffset !== 'auto')) { this.$element.css({left: left + 'px'}); this.$element.css({margin: '0px'}); } -- 2.47.2