Skip to main content

JQuery - Check if all content has been loaded

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.

Looking for Expert WordPress or Drupal development?

I am a freelance website developer and designer based in the UK. I work as a remote Drupal developer, WordPress developer and Front-end developer for a variety of startups, charities and international businesses in Bristol, Bath, London and Europe. You can learn more about me by visiting my resume page.

Get in touch for a free quote on your next project and if you want to connect me with then check out my LinkedIn profile.