From 21976813a80d566b7aec45983476bc3f90f3b22a Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Sun, 11 Mar 2018 23:35:53 +0100 Subject: [PATCH] fix: remove the open classes if no visible reveal exists after destroying one --- js/foundation.reveal.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/foundation.reveal.js b/js/foundation.reveal.js index 32c5d49fc..5f95eef4f 100644 --- a/js/foundation.reveal.js +++ b/js/foundation.reveal.js @@ -278,6 +278,11 @@ class Reveal extends Plugin { $('html').addClass('is-reveal-open'); } + function removeRevealOpenClasses() { + + $('html').removeClass('is-reveal-open'); + } + // Motion UI method of reveal if (this.options.animationIn) { function afterAnimation(){ @@ -409,7 +414,7 @@ class Reveal extends Plugin { var scrollTop = parseInt($("html").css("top")); if ($('.reveal:visible').length === 0) { - $('html').removeClass('is-reveal-open'); + removeRevealOpenClasses(); } Keyboard.releaseFocus(_this.$element); @@ -469,6 +474,10 @@ class Reveal extends Plugin { this.$element.hide().off(); this.$anchor.off('.zf'); $(window).off(`.zf.reveal:${this.id}`); + + if ($('.reveal:visible').length === 0) { + removeRevealOpenClasses(); + } }; } -- 2.47.2