10 domestic and foreign jQuery CDN performance competitions, jquerycdn
JQuery is the most common and popular javascript library in front-end development. How can we load it to improve the performance of our projects and ask what to use CDN? When users access their websites, they load files from the server. Each server can only download 2-4 files at the same time, which will reduce the file execution efficiency. If multiple servers are used, in this way, the number of files simultaneously loaded is (2-4) * The number of servers. Therefore, we put jQuery on the CDN to improve the file loading efficiency of the website. The following describes the CDN of commonly used jQuery.
CDN introduction:
This Is What Baidu encyclopedia introduces:
CDN stands for Content Delivery Network (CDN. The basic idea is to avoid bottlenecks and links on the Internet that may affect data transmission speed and stability, so that content transmission can be faster and more stable. A layer of smart virtual network formed by placing node servers in various parts of the network on the basis of the existing Internet, the CDN system can redirect users' requests to the nearest service node in real time based on the network traffic and connection, load status, distance to the user and response time of each node.. The aim is to allow users to obtain the desired content nearby, solve the problem of Internet congestion, and improve the response speed when users access the website.
Advantages:
Foreign CDN:
It can be seen that CDNjs is the fastest CDN in foreign countries.
CDN in China:
We can see that qiniu is the fastest in China.
Summary:
Apart from the services of Google and CDNJS outside China, Chinese libraries do not support the HTTPS environment. Unfortunately, Chinese users are loading slowly, if you set up your website abroad, you can give priority to it. If CDN fails to load, we need to load our local jQuery file. You only need to add the following code to the header.
1 <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>2 <script>window.jQuery || document.write('<script src="js/jquery-1.11.1.min.js" type="text/javascript"><\/script>')</script>
The above speed test is local and has a lot to do with the network and bandwidth. It is best to re-test these cdns in your own environment, if you have other cdns, You Can @ me. I hope this article will help you.
How to deal with JQUERY: if there is a table and there are 10 td files in it, how can we make an event corresponding to each table?
$ ("Table"). find ("td"). bind ("mouseover", aa );
No.
How does jquery add events cyclically? There are 10 li events, and different events are displayed when you click them.
$ ("Ul li"). each (function (I ){
// I is the index of li. You can bind different events to different I.
});