From: Nicolas Coden Date: Wed, 17 Jan 2018 17:14:27 +0000 (+0100) Subject: fix: fix off-canvas option `revealOn` when used without classes #10867 X-Git-Tag: v6.6.0~3^2~316^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=594cf65aa;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: fix off-canvas option `revealOn` when used without classes #10867 Closes: https://github.com/zurb/foundation-sites/issues/10867 --- diff --git a/js/foundation.offcanvas.js b/js/foundation.offcanvas.js index 9fbb0bc03..5614084fb 100644 --- a/js/foundation.offcanvas.js +++ b/js/foundation.offcanvas.js @@ -120,8 +120,11 @@ class OffCanvas extends Plugin { this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className); + // Get the revealOn option from the class / ensure the `reveal-on-*` class is set. if (this.options.isRevealed === true) { + if (this.options.revealOn) this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2]; + this.$element.first().addClass(`reveal-for-${this.options.revealOn}`); this._setMQChecker(); }