JavaScript on All Images Loaded
Here's something I probably knew once, but it bit me recently. If you want to run some JavaScript after all images are loaded, use window.onload
not document.onload
. This is important when working with DOM elements whose dimensions can change based on unknown image sizes.
Written by Chris Kentfield
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Related Tags
#javascript
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#