]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
changed.zf.mediaquery improvements
authorjk <j.koehler@modulingo.de>
Wed, 20 Apr 2016 23:26:42 +0000 (01:26 +0200)
committerjk <j.koehler@modulingo.de>
Wed, 20 Apr 2016 23:26:42 +0000 (01:26 +0200)
this.current = newSize; (should be set before window triggered because if something goes wrong changed.zf.mediaquery fires constantly)

js/foundation.util.mediaQuery.js

index baa1f0b8721c69adca213ed737a0271aae7396cc..c5940ceba50ddb61af435c2eee0309eadd2b3016 100644 (file)
@@ -109,11 +109,11 @@ var MediaQuery = {
       var newSize = this._getCurrentSize();
 
       if (newSize !== this.current) {
-        // Broadcast the media query change on the window
-        $(window).trigger('changed.zf.mediaquery', [newSize, this.current]);
-
         // Change the current media query
         this.current = newSize;
+
+        // Broadcast the media query change on the window
+        $(window).trigger('changed.zf.mediaquery', [newSize, this.current]);
       }
     });
   }