Last Updated: February 25, 2016
·
381
· mountaincode

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.