Skip to content

Instantly share code, notes, and snippets.

@catdad
Created March 6, 2014 20:47
Show Gist options
  • Save catdad/9399313 to your computer and use it in GitHub Desktop.
Save catdad/9399313 to your computer and use it in GitHub Desktop.
A document.ready event
!function(){
var ready = function(){
//do stuff now!
};
var readyCheck = function(){ (document.readyState === 'complete') && ready(); };
if (document.addEventListener){
document.addEventListener('readystatechange', readyCheck, false);
}
else {
document.attachEvent('onreadystatechange', readyCheck);
}
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment