From 7ff39a7abdfecf46499fe8a266f6923b110b0bf3 Mon Sep 17 00:00:00 2001 From: auginator Date: Thu, 14 Jul 2016 17:03:04 -0400 Subject: [PATCH] Example implimentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit – 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 --- js/foundation.equalizer.js | 2 +- js/foundation.sticky.js | 2 +- js/foundation.tooltip.js | 2 +- js/foundation.util.mediaQuery.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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]); -- 2.47.2