Skip to content

Instantly share code, notes, and snippets.

@gaina-jp
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaina-jp/126d0f14e12d4839d5e9 to your computer and use it in GitHub Desktop.
Save gaina-jp/126d0f14e12d4839d5e9 to your computer and use it in GitHub Desktop.
画像全部ロードしたかどうかのやつ
_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