From: Darth Vader Date: Thu, 12 Feb 2015 22:48:01 +0000 (+0000) Subject: Equalizer fix pictures with predefined height X-Git-Tag: v5.5.2~116^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6290%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Equalizer fix pictures with predefined height 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 --- diff --git a/js/foundation/foundation.js b/js/foundation/foundation.js index f9c877888..f5e56b0d8 100644 --- a/js/foundation/foundation.js +++ b/js/foundation/foundation.js @@ -599,7 +599,19 @@ 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); }