开发者

LABjs problem, not loading scripts

Trying to implement LABjs on a new site. Seems very straight-forward to implement, except that it doesn't appear to be loading my scripts at all. When I examine my site in Firebug, it gives errors about not being able to access my JS files.

The paths on these JS files should be correct because as soon as I copy them out of LABjs' format and into normal script tags, they load fine.

Pretty mystified why this isn't working. Help appreciated!

Code excerpts:

<script type="text/javascript" src="../javascript/LAB.js"></script> 

<script>
$LAB   
.script(开发者_开发百科"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js")
.script("../javascript/jquery.jcarousel.js")
.script("../javascript/jquery.fancybox.js")
.script("../javascript/jquery.timer.js")
.script("../javascript/jquery.slideshow.js")
.script("../javascript/common.js")
.script("../javascript/common.homepage.js")
.script("../javascript/swfobject.js")
.script("../javascript/jwplayer.js")
</script>


If the paths are correct, I'm not sure why the scripts aren't loading, but I can tell you that you will probably have some issues with the execution order of the script. Some of this scripts are dependent on others (i.e. the jquery plugins are dependent on jquery to be loaded and executed first...) so you'll need preserve that order. You can do it by adding a .wait() at the end of the script that others depend on. For example:

<script>
$LAB
.script("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js").wait()
.script("../javascript/jquery.jcarousel.js")
.script("../javascript/jquery.fancybox.js")
...
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜