]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Check readyState that works with different browsers. 9272/head
authorMilos Sakovic <m@deva.co>
Tue, 18 Oct 2016 15:00:14 +0000 (17:00 +0200)
committerMilos Sakovic <m@deva.co>
Tue, 18 Oct 2016 15:00:14 +0000 (17:00 +0200)
js/foundation.util.timerAndImageLoader.js

index 2e9f9e6738161d7601702979385f87a593fd2709..0da3e054e193abbdc8377fe0b58b40e7acef06d4 100644 (file)
@@ -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();