Created
September 30, 2015 20:29
-
-
Save gandhiShepard/95955a1ee7040e786c61 to your computer and use it in GitHub Desktop.
DOM Ready vanilla JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DOMReady function | |
// Can't remember where I found this... | |
// I'll add attributes later | |
var domReady = function(callback) { | |
document.readyState === "interactive" || document.readyState === "complete" ? callback() : document.addEventListener("DOMContentLoaded", callback); | |
}; | |
domReady(function() { | |
console.log( 'What up! This DOM is ready yo!' ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment