From db964c080b0c3c457687c4eaf5f538033d651afa Mon Sep 17 00:00:00 2001 From: Darth Vader Date: Thu, 12 Feb 2015 22:48:01 +0000 Subject: [PATCH] Equalizer fix pictures with predefined height MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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); } -- 2.47.2