]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fixes mutateme.zf.trigger fires as often as many submenu you got because it's in... 9948/head
authorjk <j.koehler@modulingo.de>
Tue, 11 Apr 2017 18:25:57 +0000 (20:25 +0200)
committerjk <j.koehler@modulingo.de>
Tue, 11 Apr 2017 18:25:57 +0000 (20:25 +0200)
i'got a menu with 92 submenu's and wondered why the performance is so weak on clicking on the responsiveToggle, so i started searching an found that the mutateme event gets fired as many times as there are submenus, and on the drilldown then 92 times the _getMaxDims was executedthis calcs the heights and so on and is very performant, so i debugged it an moved it to the _registerEvents function

big performance improvement

js/foundation.drilldown.js

index 3e5f72da4064dacb33db0b3cccb53c9b3fa20643..2f9800a70eccf1cfbd31b9c51284d77e7fe5360d 100644 (file)
@@ -153,7 +153,6 @@ class Drilldown {
         });
       }
     });
-         this.$element.on('mutateme.zf.trigger', this._resize.bind(this));
   }
 
   /**
@@ -166,6 +165,7 @@ class Drilldown {
       this._bindHandler = this._scrollTop.bind(this);
       this.$element.on('open.zf.drilldown hide.zf.drilldown closed.zf.drilldown',this._bindHandler);
     }
+    this.$element.on('mutateme.zf.trigger', this._resize.bind(this));
   }
 
   /**