From: therufa Date: Wed, 23 Aug 2017 09:06:54 +0000 (+0200) Subject: Reveal: Add the possibility to disable the vOffset X-Git-Tag: v6.4.4-rc1~17^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F10570%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git 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. --- 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'}); }