Created
July 1, 2014 15:33
-
-
Save yairEO/c4a65143110529383f37 to your computer and use it in GitHub Desktop.
detect progressive jpeg loaded
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check if PROGRESSIVE image was loaded | |
var duration = 60, | |
interval = setInterval(checkImageLoaded, duration), | |
maxTime = 3000; | |
function checkImageLoaded(){ | |
maxTime -= duration; | |
// image was loaded (or should have been) | |
if( photo.naturalWidth ){ | |
clearInterval(interval); | |
doStuff(); | |
} | |
if( maxTime < 0 ) | |
clearInterval(interval); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
playground page - http://jsfiddle.net/vsync/93jfc/1/