From b39664a2e2b11dac43a7c49fd000080290921b5e Mon Sep 17 00:00:00 2001 From: Kevin Ball Date: Mon, 9 Jan 2017 15:13:17 -0800 Subject: [PATCH] Replace global resize handler in interchange with zf trigger --- js/foundation.interchange.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/foundation.interchange.js b/js/foundation.interchange.js index 6094908bd..47a189045 100644 --- a/js/foundation.interchange.js +++ b/js/foundation.interchange.js @@ -35,6 +35,12 @@ class Interchange { * @private */ _init() { + var id = this.$element[0].id || Foundation.GetYoDigits(6, 'interchange'); + this.$element.attr({ + 'data-resize': id, + 'id': id + }); + this._addBreakpoints(); this._generateRules(); this._reflow(); @@ -46,9 +52,7 @@ class Interchange { * @private */ _events() { - $(window).on('resize.zf.interchange', Foundation.util.throttle(() => { - this._reflow(); - }, 50)); + this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', this._reflow.bind(this)); } /** @@ -172,7 +176,7 @@ class Interchange { * @function */ destroy() { - //TODO this. + this.$element.off('resizeme.zf.trigger') } } -- 2.47.2