Last active
August 29, 2015 14:06
-
-
Save gaina-jp/126d0f14e12d4839d5e9 to your computer and use it in GitHub Desktop.
画像全部ロードしたかどうかのやつ
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
_doc = @.document | |
_imgCheck = (callback)-> | |
_imgLen = _doc.images.length | |
_done = 0 | |
for j in [0..._imgLen] | |
if _doc.images[j].complete | |
_done++ | |
else | |
_doc.images[j].onload = ()-> | |
_done++ | |
return | |
_imgLodingChecker = setInterval( | |
()-> | |
if _done is _imgLen | |
clearInterval(_imgLodingChecker) | |
callback() | |
return | |
,33 | |
) | |
return | |
_imgCheck(init) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment