javascriptjquerylabjs

Using Labjs i get a "$ is not defined" error but the js still works, not sure why :(


i'm using LABjs for some parallel js loading goodness.

But, for some odd reason, i get a error in the debugging console of "$ is not defined".

My code is as follows:

<script>
$LAB.script("http://use.typekit.com/blah.js").script("/assets/js/libs/jquery-1.5.1.min.js").script("/assets/js/libs/basic-jquery-slider.min.js").wait().script("/assets/js/libs/modernizr-1.7.min.js").script("/assets/js/libs/jquery.watermarkinput.js").wait().script("/assets/js/libs/jquery-ui-1.8.14.custom.min.js").wait().script("/assets/js/effects.js").wait(function(){});

And in my effects.js i have.

try{Typekit.load();}catch(e){}
$('#banner').bjqs({
'width' : 980,
'height' : 212,
'showMarkers' : false,
'showControls' : false,
'centerMarkers' : false
});

Everything works, but i get the aforementioned error. I don't understand why, the jquery object should be there (and must be as everything works) so why the error?

Any ideas? I'm sure i'm using labjs correctly but i think this error is upsetting IE7 :(

I should probably be adding a $(document).ready round the latter code? but that seems to upset labjs.

Thanks for any help in advance!


Solution

  • I've just realised that hidden in an include in the footer is another call to my effects.js file. But this is in normal script tags. That would explain why it's running with an error then working as it's being called twice, once inside labjs and once not. What an idiot :( Thanks for trying though everyone! And sorry!