Posted By


fulvius on 12/04/10

Tagged


Statistics


Viewed 70 times
Favorited by 0 user(s)

prepare loadJquery


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function loadJquery(onLoadListener){
  2. loadJquery.loaded = false;
  3. var fileref = loadJSfile("https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
  4. fileref.hasStarteHelper = false; // usando variavel estatica
  5. if(! loadJquery.loaded){
  6. fileref.onreadystatechange= function () {
  7.  
  8. if(!this.hasStarteHelper){
  9. if (this.readyState == 'complete' || this.readyState == 'loaded'){
  10. onLoadListener();
  11. loadJquery.loaded = true;
  12. }
  13. }
  14. };
  15.  
  16. fileref.onload= function () {
  17. if(!this.hasStarteHelper){
  18. onLoadListener();
  19. loadJquery.loaded = true;
  20. }
  21. };
  22.  
  23. }else{
  24. onLoadListener();
  25. }
  26. }
  27.  
  28.  
  29.  
  30. function prepareToDisplay(){
  31. // alert('adObj');
  32. var executeWhenJqueryLoad = function(){
  33. // alert('JqueryCarregado!');
  34. $(document).ready(function(){
  35. alert('JqueryCarregado!');
  36. // displayAdInClassEl(null);
  37. });
  38. };
  39.  
  40. loadJquery(executeWhenJqueryLoad);
  41. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.