Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. // source => FB: Simple Javascript
  2. function ready(callback){
  3. // in case the document is already rendered
  4. if(document.readyState != 'loading') callback();
  5.  
  6. // modern browsers
  7. else if(document.addEventListener)
  8. document.addEventListener('DOMContentLoaded', callback);
  9. // IE < 8
  10. else document.attachEvent('onreadystatechange', function(){
  11. if(document.readyState == 'complete') callback();
  12. });
  13. }
  14.  
  15. ready(function(){
  16. // do something
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement