]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Merge pull request #10422 from SassNinja/further-fix-reveal-content-classes
authorHarry Manchanda <harmanmanchanda182@gmail.com>
Fri, 21 Jul 2017 16:10:20 +0000 (21:40 +0530)
committerKevin Ball <kmball11@gmail.com>
Tue, 25 Jul 2017 00:10:47 +0000 (17:10 -0700)
Further fix for off-canvas content classes

js/foundation.offcanvas.js

index fa2dd30a5dd098bb32893450e2edd8feeb49b84d..9fbb0bc0341b6006803b6deebc6dc4f52d2487bd 100644 (file)
@@ -175,12 +175,14 @@ class OffCanvas extends Plugin {
   /**
    * Removes the CSS transition/position classes of the off-canvas content container.
    * Removing the classes is important when another off-canvas gets opened that uses the same content container.
+   * @param {Boolean} hasReveal - true if related off-canvas element is revealed.
    * @private
    */
   _removeContentClasses(hasReveal) {
-    this.$content.removeClass(this.contentClasses.base.join(' '));
-    if (hasReveal === true) {
-      this.$content.removeClass(this.contentClasses.reveal.join(' '));
+    if (typeof hasReveal !== 'boolean') {
+      this.$content.removeClass(this.contentClasses.base.join(' '));
+    } else if (hasReveal === false) {
+      this.$content.removeClass(`has-reveal-${this.position}`);
     }
   }
 
@@ -192,8 +194,9 @@ class OffCanvas extends Plugin {
    */
   _addContentClasses(hasReveal) {
     this._removeContentClasses(hasReveal);
-    this.$content.addClass(`has-transition-${this.options.transition} has-position-${this.position}`);
-    if (hasReveal === true) {
+    if (typeof hasReveal !== 'boolean') {
+      this.$content.addClass(`has-transition-${this.options.transition} has-position-${this.position}`);
+    } else if (hasReveal === true) {
       this.$content.addClass(`has-reveal-${this.position}`);
     }
   }