From 673f02341517f276cc9c096d33037181037aca53 Mon Sep 17 00:00:00 2001 From: Milos Sakovic Date: Tue, 18 Oct 2016 17:00:14 +0200 Subject: [PATCH] Check readyState that works with different browsers. --- js/foundation.util.timerAndImageLoader.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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(); -- 2.47.2