From 7f30ef811ccfe4dd10c9231db7646816c1d1c52d Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Mon, 12 Mar 2018 08:41:30 +0100 Subject: [PATCH] fix: make removeRevealOpenClasses and addRevealOpenClasses available for the whole component --- js/foundation.reveal.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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 } }; } -- 2.47.2