hck2-dev
Version:
Development Tools For HCK2
22 lines (18 loc) • 559 B
JavaScript
// IE8+
// Same as jQuery's "$(document).ready(function(){ console.log('hello world'); });"
/* How To Use
DocumentReady(function() {
console.log('hello world');
});
*/
function DocumentReady(fn) {
if (document.readyState !== 'loading') {
fn();
} else if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', fn);
} else {
document.attachEvent('onreadystatechange', function () {
if (document.readyState !== 'loading') { fn(); }
});
}
}