LABjs问题,无法加载脚本
尝试在新站点上实施 LABjs。实施起来似乎非常简单,只是它似乎根本没有加载我的脚本。当我在 Firebug 中检查我的网站时,它给出了有关无法访问我的 JS 文件的错误。
这些 JS 文件上的路径应该是正确的,因为一旦我将它们从 LABjs 格式复制到正常的脚本标签中,它们就可以正常加载。
很困惑为什么这不起作用。帮助表示感谢!
代码摘录:
<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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果路径正确,我不确定为什么脚本没有加载,但我可以告诉您,您可能会遇到脚本执行顺序的一些问题。其中一些脚本依赖于其他脚本(即 jquery 插件依赖于首先加载和执行的 jquery...),因此您需要保留该顺序。您可以通过在其他人依赖的脚本末尾添加 .wait() 来完成此操作。例如:
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: