]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: make removeRevealOpenClasses and addRevealOpenClasses available for the whole... 11041/head
authorDaniel Ruf <daniel.ruf@ueberbit.de>
Mon, 12 Mar 2018 07:41:30 +0000 (08:41 +0100)
committerDaniel Ruf <daniel.ruf@ueberbit.de>
Mon, 12 Mar 2018 07:41:30 +0000 (08:41 +0100)
js/foundation.reveal.js

index c8a42a9a80e1dc0bbfc92156ed1026e67da22973..b2d6e7192fdd9538615eafdf300fcaaf22a0926e 100644 (file)
@@ -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
     }
   };
 }