From: Daniel Ruf Date: Mon, 12 Mar 2018 07:41:30 +0000 (+0100) Subject: fix: make removeRevealOpenClasses and addRevealOpenClasses available for the whole... X-Git-Tag: v6.6.0~3^2~281^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f30ef811ccfe4dd10c9231db7646816c1d1c52d;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: make removeRevealOpenClasses and addRevealOpenClasses available for the whole component --- diff --git a/js/foundation.reveal.js b/js/foundation.reveal.js index c8a42a9a8..b2d6e7192 100644 --- a/js/foundation.reveal.js +++ b/js/foundation.reveal.js @@ -273,14 +273,6 @@ class Reveal extends Plugin { var _this = this; - function addRevealOpenClasses() { - $('html').addClass('is-reveal-open'); - } - - function removeRevealOpenClasses() { - $('html').removeClass('is-reveal-open'); - } - // Motion UI method of reveal if (this.options.animationIn) { function afterAnimation(){ @@ -290,7 +282,7 @@ class Reveal extends Plugin { 'tabindex': -1 }) .focus(); - addRevealOpenClasses(); + _this.addRevealOpenClasses(); Keyboard.trapFocus(_this.$element); } if (this.options.overlay) { @@ -320,7 +312,7 @@ class Reveal extends Plugin { .focus(); Keyboard.trapFocus(this.$element); - addRevealOpenClasses(); + this._addRevealOpenClasses(); this._extraHandlers(); @@ -331,6 +323,14 @@ class Reveal extends Plugin { this.$element.trigger('open.zf.reveal'); } + _addRevealOpenClasses() { + $('html').addClass('is-reveal-open'); + } + + _removeRevealOpenClasses() { + $('html').removeClass('is-reveal-open'); + } + /** * Adds extra event handlers for the body and window if necessary. * @private @@ -412,7 +412,7 @@ class Reveal extends Plugin { var scrollTop = parseInt($("html").css("top")); if ($('.reveal:visible').length === 0) { - _this.removeRevealOpenClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal + _this._removeRevealOpenClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal } Keyboard.releaseFocus(_this.$element); @@ -474,7 +474,7 @@ class Reveal extends Plugin { $(window).off(`.zf.reveal:${this.id}`); if ($('.reveal:visible').length === 0) { - _this.removeRevealOpenClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal + this._removeRevealOpenClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal } }; }