loranger / lazyLoader

A Javascript snippet for assets lazy loading
1 stars 0 forks source link

tips #1

Closed ghost closed 11 years ago

ghost commented 11 years ago

Hello,

it works well and it's confortable...

one thing doesn't work in your sample code : (snip) $('body').append('<h1>jQuery is now avalaible</h1>');

this works :

    var load = new lazyLoader();

    load.jquery(function(){

       load.js('{{ STATIC_URL }}js/jquery.kenburns.js', function(){
                $('#kenburns-container1').kenburns();
                $('#kenburns-container2').kenburns();
        });

       load.js('{{ STATIC_URL }}js/jquery.typewriter.js', function(){
              $('#typewriter-container').typewriter({ 'text' : 'Salut, ca va la compagnie ?'});
        });
    });

    $(function(){
          $("<h1></h1>").text("jQuery is now available").appendTo('body');
    }); 

surely instance issue for jquery in the first callback, haven't taken time to take a look :p

loranger commented 11 years ago

I'm sorry, but this simple markup works perfectly for me. Can you double-check on your side ?

ghost commented 11 years ago

i know why, i call the script in the head part, dom isn't loaded yet.