Skip to content

Instantly share code, notes, and snippets.

@yairEO
Created July 1, 2014 15:33
Show Gist options
  • Save yairEO/c4a65143110529383f37 to your computer and use it in GitHub Desktop.
Save yairEO/c4a65143110529383f37 to your computer and use it in GitHub Desktop.
detect progressive jpeg loaded
// 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);
@yairEO
Copy link
Author

yairEO commented Jul 1, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment