带有jQuery的Javascript加载器 [英] Javascript loaders with jQuery
问题描述
我对使用Javascript加载程序感兴趣,并希望使用与jQuery完美配合的加载程序.我找到了此比较表: https://spreadsheets.google.com/lv?key=tDdcrv9wNQRCNCRCflWxhYQ
I'm interested in using a Javascript loader and want to use one which plays nicely with jQuery. I found this comparison table: https://spreadsheets.google.com/lv?key=tDdcrv9wNQRCNCRCflWxhYQ
但是,我想从有经验的人那里获得推荐,推荐他们使用jQuery和jQuery UI.
However, I'd like to get a recommendation from someone with experience with using any of these with jQuery and jQuery UI.
修改:
混合使用jQuery和JS加载程序的两个主要问题如下:
The two primary concerns with mixing jQuery and JS loaders are as follows:
- 是否会有名称空间冲突?
- 会有任何意想不到的行为吗?
对于名称空间,jQuery的文档对此进行了广泛的介绍.
For namespaces, jQuery's documentation covers this extensively.
对于意外行为,您可能会遇到的问题是,在加载jQuery之前DOM已经处于就绪状态,从而导致您的$(document).ready(handler)
不会触发.您可以通过不使用它们并假设您的DOM已准备就绪来避免这种情况.
For unexpected behavior, something you might run into is that the DOM is already in the ready state before jQuery gets loaded in, causing your $(document).ready(handler)
s to not fire. You can avoid this by just not using them and assuming your DOM is ready.
如果我想念其他人,请发表评论.
If I'm missing others, please comment.
资源
http://www. nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/
推荐答案
在我的拙见中,YUI 3具有目前所有JS框架中最好的体系结构.因此,它们的依赖项管理和动态脚本加载是我的最爱.我确实喜欢jQuery的简单性和出色的社区,因此我将两者结合使用起来没有太多麻烦:
In my humble opinion, YUI 3 has the best architecture of any JS framework out there. Their dependency management and dynamic script loading is, therefore, my favorite. I do love jQuery's simplicity and great community so I've used the two together without too much trouble:
将jQuery和YUI混合在一起在一个应用程序中,这很容易吗?
这篇关于带有jQuery的Javascript加载器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!