jQuery environment construction
Enter the official website to get the latest version http://jquery.com/download/. It should be noted here that jQuery is divided into 2 series versions 1.x and 2.x. The main difference is that 2.x is no longer compatible with IE6, 7 and 8 browsers, the purpose of this is to be compatible with mobile terminal development. This version is smaller and faster than jQuery 1.x due to some code reduction.
If developers are more concerned about users of older versions of IE, they can only use jQuery 1.9 and earlier versions. For compatibility reasons, our course uses version 1.9. Each series of jQuery versions is divided into: compressed version (compressed) and development version (development). We use the development version during the development process (the development version is convenient for code modification and debugging). The compressed version is used for online release of the project (because the compressed version is larger in size). Smaller and faster).
jQuery is a JavaScript script library that does not require special installation. We only need to introduce the jQuery library through the script tag in the
tag of the page.环境搭建
Alternatives
If you don't want to download and host jQuery, you can also reference it through a CDN (Content Delivery Network).
The servers of Baidu, Youpaiyun, Sina, Google and Microsoft all have jQuery.
If your site users are domestic, it is recommended to use domestic CDN addresses such as Baidu, Youpaiyun, Sina, etc. If your site users are foreign, you can use Google and Microsoft.
Note: All examples on this site use Baidu jQuery CDN library.
To reference jQuery from Baidu, Youpaiyun, Sina, Google or Microsoft, please use one of the following codes:
这是一个标题
这是一个段落。
这是另一个段落。
Get the latest available version through Google CDN:
It is not recommended to use Google CDN to obtain versions, because Google products are very unstable in China.
If you observe what's on the Google URL - the jQuery version (1.8.0) is specified in the URL. If you wish to use the latest version of jQuery, you can also remove a number from the end of the version string (such as 1.8 in this example) and Google will return the latest available version in the 1.8 series (1.8.0, 1.8.1, etc.), or It is also possible to leave only the first number, and Google will return the latest available version in the 1 series (from 1.1.0 to 1.9.9).
Using Baidu, Youpaiyun, Sina, Google or Microsoft's jQuery has a big advantage:
Many users have already started from when visiting other sites. Baidu, Youpaiyun, Sina, Google or Microsoft have loaded jQuery. All the result is that when they visit your site, jQuery is loaded from cache, which reduces load times. At the same time, most CDNs ensure that when a user requests a file from them, a response is returned from the server closest to the user, which can also improve loading speeds.