]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Replace global resize handler in interchange with zf trigger
authorKevin Ball <kmball11@gmail.com>
Mon, 9 Jan 2017 23:13:17 +0000 (15:13 -0800)
committerKevin Ball <kmball11@gmail.com>
Mon, 9 Jan 2017 23:13:50 +0000 (15:13 -0800)
js/foundation.interchange.js

index 6094908bd9d68a99b124bb767f2ccda366fbf9f8..47a1890450451c6cb726968c6d67e781eb391982 100644 (file)
@@ -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')
   }
 }