JQuery entry-progress bar, jquery entry

Source: Internet
Author: User

JQuery entry-progress bar, jquery entry

More and more people feel that regular javascript cannot keep up with the pace, and they plan to learn more advanced, starting with JQuery.

JQuery is a Javascript library that can be downloaded from JQuery.com and stored locally.

<Script src = "jquery. js"> </script>

Statement. If you do not want to download jquery, You can reference the jquery library on the web and reference their jquery library from google or Microsoft servers.

Reference google's jquery Library:

<Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"> </script>

Reference Microsoft's jquery Library:

<Script src = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"> </script>

We recommend that you reference google or Microsoft's jquery library. Many users have loaded jQuery from Google or Microsoft when visiting other sites. The result is that jQuery is loaded from the cache when they access your site, which can reduce the loading time. At the same time, most cdns can ensure that when users request files from them, they will return a response from the server closest to the user, which can also increase the loading speed.

All JQuery functions are located in a document ready function.

$ (Document). ready (function (){
--- JQuery functions go here ----
});

This is to prevent the document from running jQuery code before it is fully loaded (ready. If you run the function before the document is fully loaded, the operation may fail.

The Jquery selector will not be mentioned. The two points to be noted are all over. The following shows an example. I re-wrote the progress bar written in conventional javascript with jquery. Although the knowledge points used are very simple, however, writing it out also takes me a bit of thought, because some things are still different from conventional javascript, which is put behind the code. The complete code of the progress bar is as follows.

<! Doctype html> 

This time it mainly took some time to increase the score by, because the setTimeout () function is used. In jquery, setTimeout (code, delay) if the code in it is a function, you only need to fill in the function name, no quotation marks, no parentheses. For example, if you have a function show () and call show () after setting ms, you should write in jquery as follows:

SetTimeout (show, 500 );

In traditional javascript, you need to write as follows:

SetTimeout ("show ()", 500 );

This is also true for setInterval.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.