]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: fix off-canvas option `revealOn` when used without classes #10867
authorNicolas Coden <nicolas@ncoden.fr>
Wed, 17 Jan 2018 17:14:27 +0000 (18:14 +0100)
committerNicolas Coden <nicolas@ncoden.fr>
Wed, 17 Jan 2018 17:14:27 +0000 (18:14 +0100)
Closes: https://github.com/zurb/foundation-sites/issues/10867
js/foundation.offcanvas.js

index 9fbb0bc0341b6006803b6deebc6dc4f52d2487bd..5614084fbd0eadb2a4b214d9b07868811a9043f9 100644 (file)
@@ -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();
     }