]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Equalizer fix pictures with predefined height 6290/head
authorDarth Vader <brave.pineapple@gmail.com>
Thu, 12 Feb 2015 22:48:01 +0000 (22:48 +0000)
committerDarth Vader <brave.pineapple@gmail.com>
Thu, 12 Feb 2015 22:48:01 +0000 (22:48 +0000)
Equaliser doesn’t wait until pictures will be loaded if all the
pictures in element to be equalised are provided with ‘height’
attribute.

This fixes the error when using AngularJS and pictures come with 404
error. Before this equaliser didn’t work at all.

Also: https://github.com/zurb/foundation/issues/6276

js/foundation/foundation.js

index f9c877888f802cb9132314331c442fbdd39e5a1f..f5e56b0d8e6e56ac4f64f3a5034d6cca7cfb9fd3 100644 (file)
         var self = this,
             unloaded = images.length;
 
-        if (unloaded === 0) {
+        function pictures_has_height(images) {
+          var pictures_number = images.length;
+
+          for (var i = pictures_number - 1; i >= 0; i--) {
+            if(images.attr('height') === undefined) {
+              return false;
+            };
+          };
+
+          return true;
+        }
+
+        if (unloaded === 0 || pictures_has_height(images)) {
           callback(images);
         }