From: Milos Sakovic Date: Tue, 18 Oct 2016 15:00:14 +0000 (+0200) Subject: Check readyState that works with different browsers. X-Git-Tag: v6.3-rc1~41^2~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9272%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Check readyState that works with different browsers. --- diff --git a/js/foundation.util.timerAndImageLoader.js b/js/foundation.util.timerAndImageLoader.js index 2e9f9e673..0da3e054e 100644 --- a/js/foundation.util.timerAndImageLoader.js +++ b/js/foundation.util.timerAndImageLoader.js @@ -59,12 +59,11 @@ function onImagesLoaded(images, callback){ } images.each(function() { - if (this.complete) { - singleImageLoaded(); - } - else if (typeof this.naturalWidth !== 'undefined' && this.naturalWidth > 0) { + // Check if image is loaded + if (this.complete || (this.readyState === 4) || (this.readyState === 'complete')) { singleImageLoaded(); } + // Force load the image else { $(this).one('load', function() { singleImageLoaded();