J Norton Freelance Interactive Designer Logo
Jun
21

JQuery - Check if all content has been loaded

Sat, 06/21/2008 - 10:55 | Tags:

Over the weekend I was struggling to find a way to test if all content had been loaded into the browser before making a function call. Well I found the answer:

$(window).load(function() { callFunction(); });

This little snippet waits until all external content has loaded before making the function call. So if you need all static files - images, javascript, flash, etc - to be fully loaded before firing an event then use the above snippet.