Skip to content

Commit

Permalink
Merge pull request #10422 from SassNinja/further-fix-reveal-content-c…
Browse files Browse the repository at this point in the history
…lasses

Further fix for off-canvas content classes
  • Loading branch information
IamManchanda authored Jul 21, 2017
2 parents 5ffe932 + 113d901 commit fe0d099
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions js/foundation.offcanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
}

Expand All @@ -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}`);
}
}
Expand Down

0 comments on commit fe0d099

Please sign in to comment.