From: auginator Date: Thu, 14 Jul 2016 21:03:04 +0000 (-0400) Subject: Example implimentation X-Git-Tag: v6.3-rc1~60^2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9008%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Example implimentation – Fixed a derp in the mediaQuery is method’s conditional check for the length of the string. - Replaced atLeast() with new is() method in equalizer, tooltip and sticky --- diff --git a/js/foundation.equalizer.js b/js/foundation.equalizer.js index f20f279f2..2ec93638f 100644 --- a/js/foundation.equalizer.js +++ b/js/foundation.equalizer.js @@ -87,7 +87,7 @@ class Equalizer { * @private */ _checkMQ() { - var tooSmall = !Foundation.MediaQuery.atLeast(this.options.equalizeOn); + var tooSmall = !Foundation.MediaQuery.is(this.options.equalizeOn); if(tooSmall){ if(this.isOn){ this._pauseEvents(); diff --git a/js/foundation.sticky.js b/js/foundation.sticky.js index cfe356ffc..9241bd7c2 100644 --- a/js/foundation.sticky.js +++ b/js/foundation.sticky.js @@ -267,7 +267,7 @@ class Sticky { * @private */ _setSizes(cb) { - this.canStick = Foundation.MediaQuery.atLeast(this.options.stickyOn); + this.canStick = Foundation.MediaQuery.is(this.options.stickyOn); if (!this.canStick) { cb(); } var _this = this, newElemWidth = this.$container[0].getBoundingClientRect().width, diff --git a/js/foundation.tooltip.js b/js/foundation.tooltip.js index 2dc54b0ee..b568e1ace 100644 --- a/js/foundation.tooltip.js +++ b/js/foundation.tooltip.js @@ -170,7 +170,7 @@ class Tooltip { * @function */ show() { - if (this.options.showOn !== 'all' && !Foundation.MediaQuery.atLeast(this.options.showOn)) { + if (this.options.showOn !== 'all' && !Foundation.MediaQuery.is(this.options.showOn)) { // console.error('The screen is too small to display this tooltip'); return false; } diff --git a/js/foundation.util.mediaQuery.js b/js/foundation.util.mediaQuery.js index 298bd56ac..e69eaaada 100644 --- a/js/foundation.util.mediaQuery.js +++ b/js/foundation.util.mediaQuery.js @@ -68,7 +68,7 @@ var MediaQuery = { */ is(size) { size = size.trim().split(' '); - if(size.length > 0 && size[1] === 'only') { + if(size.length > 1 && size[1] === 'only') { if(size[0] === this._getCurrentSize()) return true; } else { return this.atLeast(size[0]);