-
-
Save james2doyle/ceb52c0b4b7f7e77f816 to your computer and use it in GitHub Desktop.
Using readyState to show document state
This file contains hidden or 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
// credit: Louis Lazaris | |
document.onreadystatechange = function () { | |
switch (document.readyState) { | |
case 'loading': | |
console.log('loading...'); | |
break; | |
case 'interactive': | |
console.log('DOM is ready...'); | |
break; | |
case 'complete': | |
console.log('Document complete...'); | |
break; | |
} | |
}; | |
// https://jsbin.com/diyihu/edit?html,css,js,console,output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment